Showing top n% of a report's data
Hi I have a report that is currently returning 64 rows. My users have asked that I created an identical report, except they want the new one to show the top 20% of data. I tried the Top stuff in tablix but that doesn't work as it is field by field. The data for my report has a number of sort critrion which must remain in place. So, is there a simple way of taking the result of a stored proc call (which is what my report doing) and then telling SSRS to show the top n%? Amir
June 29th, 2011 1:38pm

See if this helps: http://bidn.com/blogs/MikeDavis/ssis/1875/ssrs-top-n-and-bottom-n-reporting-with-duplicates Mike Davis, MCTS, MCITP
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2011 2:17pm

Thanks Mike. I can see this working for a single field scenario. I have four fields that drive the sorting on my report I need to show the top 20% of the report based on these four fields. It seems strange that SSRS doesn't have a simply top n% of dataset functionality.Amir
June 30th, 2011 4:44am

Thanks Mike. I can see this working for a single field scenario. I have four fields that drive the sorting on my report I need to show the top 20% of the report based on these four fields. It seems strange that SSRS doesn't have a simple top n% of dataset functionality. Amir
Free Windows Admin Tool Kit Click here and download it now
June 30th, 2011 11:27am

Hi btull89, Thanks for your question and Mike’s reply. Since you using a stored procedure in the Dataset and the results have only four fields, in addition, there is a number of sort criterion field, thus in order to achieve your requirement, there is a workaround for you: using one table variable to store the results that pulled from the stored procedure, then selecting the results from the table variable, meanwhile adding the top N% in the where condition. For example, supposing the number of sort criterion field named ordercol, please using below statement in your dataset, remember that replace the ellipsis dots with the results’ structure. declare @t table(…) insert into @t exec stored procedure name select * from @t where ordercol <@counts*0.2 Hope it helps you, if your issue still exists, please feel free to let me know. Thanks, Sharp Wang Please remember to mark the replies as answers if they help you and unmark them if they provide no help.
July 1st, 2011 9:12pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics