SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


sum of top 20 per group in piechart


sum of top 20 per group in piechart

Author
Message
uday-396564
uday-396564
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 31
Hello all,

I have a piechart which shows sum of revenue in each sales stage, is there a way to filter the data which can which will show only sum of top 20 per group in the pie chart.

thanks
uday
pietlinden
pietlinden
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5064 Visits: 13206
Can you post the SQL for your query?

You could probably do it with ROW_NUMBER() and then filter that.

SELECT [query fields], ROW_NUMBER() AS rn
FROM...

And then filter for rn<=20
ashish.shevale
ashish.shevale
SSC Veteran
SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)

Group: General Forum Members
Points: 204 Visits: 233
pietlinden (3/16/2014)
Can you post the SQL for your query?

You could probably do it with ROW_NUMBER() and then filter that.

SELECT [query fields], ROW_NUMBER() AS rn
FROM...

And then filter for rn<=20


well agree with pietlinden but if you are not gd with window function you can do a top 20 on your query without taking sum and then put this as inner query for sum
looks simple the old way

------------------------------------------------------------------------------------

Ashish
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search