Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Sort by aggregate in group or cube
Srividya Sharma
Hi
I have a table with Name and Amount.
I have grouped this by Name.
Then I create an aggregation Sum of Amount ( using palette ) and place it in group footer.
Now I want to sort this table by the aggregate Sum of Amount.
How can I do this?
Thanks
Srividya Sharma
Find more posts tagged with
Comments
mcremer
<blockquote class='ipsBlockquote' data-author="'Srividya Sharma'" data-cid="81005" data-time="1312341141" data-date="02 August 2011 - 08:12 PM"><p>
Hi<br />
<br />
I have a table with Name and Amount.<br />
<br />
I have grouped this by Name. <br />
<br />
Then I create an aggregation Sum of Amount ( using palette ) and place it in group footer.<br />
<br />
Now I want to sort this table by the aggregate Sum of Amount.<br />
<br />
How can I do this?<br />
<br />
Thanks <br />
Srividya Sharma<br /></p></blockquote>
<br />
You can add it to the sorting hoever you need to keep in mind that the GROUP you made is always stronger. Unleess you create the sum in data.<br />
<br />
But if you get your date trough a query you could also try using the folowing query method:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
SELECT SUM(a.colmun1) OVER (PARTITION BY a.colmn3 )IND_TOTAAL
FROM TABLE1 a
</pre>
<br />
This wil couse a sum over the group you want without making you have 2 group evry thing. (this will work for Oracle Databases and MS SQL Server (iim afraid its not psoible in mysql but there you could use a nother trick)).
Srividya Sharma
Thank you for replying.
I will not be able to use grouping in the query.
So I am left with the other option you suggested.
Can you please elaborate on "You can add it to the sorting hoever you need to keep in mind that the GROUP you made is always stronger. Unleess you create the sum in data."
When I try to sort by the aggregate, I get the error like, sort by an aggregate is not allowed.
Please help
Srividya Sharma
mcremer
<blockquote class='ipsBlockquote' data-author="'Srividya Sharma'" data-cid="81031" data-time="1312361789" data-date="03 August 2011 - 01:56 AM"><p>
Thank you for replying.<br />
<br />
I will not be able to use grouping in the query. <br />
<br />
So I am left with the other option you suggested.<br />
<br />
Can you please elaborate on "You can add it to the sorting hoever you need to keep in mind that the GROUP you made is always stronger. Unleess you create the sum in data."<br />
<br />
When I try to sort by the aggregate, I get the error like, sort by an aggregate is not allowed.<br />
<br />
Please help<br />
<br />
Srividya Sharma<br /></p></blockquote>
<br />
Srividya,<br />
<br />
If you use the partition by your not realy grouping in the query self. <br />
<br />
Secondly this is a rather tricky method. Were you make a data object that actealy duplicates the data and is a lot of scripting. Hense that I sugested to use the Partition By query method see <a class='bbc_url' href='
http://www.java2s.com/Code/Oracle/Analytical-Functions/PARTITIONBYdividethegroupsintosubgroups.htm'>http://www.java2s.com/Code/Oracle/Analytical-Functions/PARTITIONBYdividethegroupsintosubgroups.htm</a>
;