Hello, I'm having an issue using metrics created ...
# gooddata-cloud
Hello, I'm having an issue using metrics created through the API. When I try to use a metric created thgough the API, I'm seeing "SORRY, WE CAN'T DISPLAY THIS INSIGHT" and I can see in the console the following: "reason: "Missing aggregation, from='[dataset/{TABLENAME}/{WORSKPACEID}]' to='[]'", traceId: 'ba5a7b53256850a6'}" Here's the curl I'm using:
Copy code
curl --request POST 'https://{ENDPOINT}/api/v1/entities/workspaces/{WORSKPACEID}/metrics'   --header 'Content-Type: application/vnd.gooddata.api+json'   --header 'Authorization: Bearer {TOKEN}' --data @- <<'EOF'
  "data": {
    "attributes": {
      "title": "mytitle",
      "content": {
        "format": "#,##0",
        "maql": "SELECT SUM({fact/{COLUMNNAME}}) BY {dataset/{TABLENAME}"
    "id": "{COLUMNNAME}",
    "type": "metric"
If I create the same metric with the editor (in the browser, by copy pasting the MAQL query and selecting the rounding), then it is working fine. Is this a bug, am I missing something? Thanks in advance
Hi Simon, Could you show me the exact expression that works in Metric Editor, pease? The part of your metric after the BY clause doesn’t seem to be correct. I would rather expect something like “`BY {label/date.quarter}, {attribute/department}`“.
thanks for having a look! the expression is the following
SELECT SUM({fact/sbuyornot__secondprod____sjourney__accessories}) BY {dataset/feedbacks}
here are two screenshots: first one is created through the api and second one manually
so, i was able to solve my issue. the problem was that i used the name of a column as the id of a metric. as soon as set an id that do not collide with the column names, it is working as expected. thanks!
Huh, interesting. Thanks a lot for sharing the solution with us.