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
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive