April 2, 2013 at 2:22 am
Hello
I have a pie chart which displays many legends on a pie chart but i need to write sql code to show the top five entries/legends on the piechart. anybody provide a solution?
April 2, 2013 at 8:54 am
Would this be a matter of adding TOP 5 to the SQL statement?
Something like
SELECT TOP 5 fieldname1, fieldname2 FROM tablename
April 3, 2013 at 8:22 am
Couple of thoughts for you to consider which might not give you the answer you desire, but certainly provides options:
1) Pie charts are not the best data visualization tool. Recommend using a horizontal bar graph instead. Here's a link from a data visualization expert, Stephen Few, on the topic: http://www.perceptualedge.com/articles/visual_business_intelligence/save_the_pies_for_dessert.pdf
2) If your data is aggregated in the SQL code, you could stamp row_number() in the SQL as a separate field (called "Rank") to identify your amounts. Then reference the Rank field to trigger the visibility of the category descriptions of the top 5: = iif(Fields!Rank.value<=5,False, True).
3) If you're using SSRS 2008 R2 or above, you could easily go with data bars within a table rather than a pie chart. Again, based on some sort of rank, only show the descriptions for the top 5:
http://msdn.microsoft.com/en-us/library/ee633676(v=sql.105).aspx
4) If you're still on SSRS 2005 (like me) you could embed a chart in a table. One column would display the category, another column would contain the bar chart. (Again, based on some sort of rank, only show the descriptions for the top 5.) See "SSW Better Rules to SQL Reporting Services": http://www.ssw.com.au/ssw/standards/Rules/RulesToBetterSQLReportingServices.aspx#maxminvalues
--Pete
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply