How to give an alias to an aggregation on a column?
Hi all,
I am using the Domo Api, and I need to group by the request on the sum of a column, just like below:
stringQuery= '/data/v1/dataSetAlias?fields=alias1,alias2&sum=alias3'
+ '&groupby=alias1,alias2,"sum=alias3"
+ '&orderby="sum=alias3" descending';
domo.get(stringQuery)
...
For now, i dont know a way to give an alias to "sum=alias3" so I can groupp by on it,
the only way that works is like below (not appliying the sum on the grouping or the ordering):
stringQuery= '/data/v1/dataSetAlias?fields=alias1,alias2&sum=alias3'
+ '&groupby=alias1,alias2,"alias3"
+ '&orderby="alias3" descending';
domo.get(stringQuery)
...
But this doesn't give me the result I am waiting for.
Can you help me with this?
Thanks
Hiba
Comments
-
Can anyone help with this request?
0 -
Have you tried :
stringQuery= '/data/v1/dataSetAlias?fields=alias1,alias2,alias3'
+ '&groupby=alias1,alias2,"sum=alias3"
+ '&orderby="alias3" descending';When a groupby is present, you only want to specify the aggregation operator inside the group by clause. Let me know how this goes.
Jake Galbraith0 -
Hi Jake,
Thanks for your answer.
But this is not working. The aggregation in the groupBy doesn't work.When I do this:
stringQuery= '/data/v1/dataSetAlias?fields=alias1,alias2,alias3'
+ '&groupby=alias1,alias2,sum=alias3'
+ '&orderby=alias3 descending';I have this error on the browser console:
Failed to load resource: the server responded with a status of 406 (Not Acceptable)
domo.js:5 Uncaught (in promise) Error: Not Acceptable
at XMLHttpRequest.o.onload (domo.js:5)
Any ideas? I really need to have the alias3 aggregated and the result sorted with it.Thanks,
Hiba
0 -
Yes my mistake, this should hopefully do the trick. You just state the aggregation prior to the groupby.
stringQuery= '/data/v1/dataSetAlias?fields=alias1,alias2,alias3'
+ '&sum=alias3&groupby=alias1,alias2,alias3'
+ '&orderby=alias3 descending';Jake Galbraith0 -
Hi Jake,
Still not working.
Grouping by alias3 and not the aggregation of alias3 is splitting the result. And then I am having duplicated objects in place of grouping them and giving the total on alias3.
Help me please resolve this.
Thanks.
Hiba
0 -
Please do, let's get this working for you. You can send me a private message by clicking on my profile name and then on the right side click on send this user a private message.
Jake Galbraith0
Categories
- 10.7K All Categories
- 1 APAC User Group
- 12 Welcome
- 36 Domo News
- 9.6K Using Domo
- 1.9K Dataflows
- 2.4K Card Building
- 2.2K Ideas Exchange
- 1.2K Connectors
- 339 Workbench
- 252 Domo Best Practices
- 11 Domo Certification
- 461 Domo Developer
- 47 Domo Everywhere
- 101 Apps
- 705 New to Domo
- 84 Dojo
- Domopalooza
- 1.1K 日本支部
- 4 道場-日本支部へようこそ
- 23 お知らせ
- 63 Kowaza
- 297 仲間に相談
- 649 ひらめき共有