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.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive