Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi CodeProject fella's!

Is there a way on how to get ranking in SSRS? Are there any available functions in SSRS for me to be able to rank my data? If so, can you please share your knowledge about it? I want the ranking to be just the way as SQL Server DENSE_RANK Function.

Here's a table of what I need to do:

  AGENT          SHIFT          TOTAL          SHIFT RANK      ALL RANK
John Doe 1     9AM - 5PM      42.31                   1                    1
John Doe 2     9AM - 5PM      28.39                   3                    4
John Doe 3     9AM - 5PM      37.25                   2                    2
Jane Doe 1     5PM - 1AM      34.48                   1                    3
Jane Doe 2     5PM - 1AM      22.50                   3                    6
Jane Doe 3     5PM - 1AM      26.19                   2                    5

I want the ranking in two ways:

1.) Rank agents according to their shift based on the total.
2.) Rank all of the agents regardless of shift based on the total.

Any help, comments, and suggestions will be highly appreciated!

Thank you very much.
Posted

Here it is :

SQL
SELECT *
      , rank() over (partition by  shift order by total desc) ShiftRank
      , rank() over (order by total desc) AllRank
  FROM Agents



Hope it helps.
 
Share this answer
 
Comments
ernieball_26 7-Feb-12 3:33am    
I did it this way Amir, I guess it would be a hard time for me doing a custom code in SSRS. Thanks for the help buddy! (",)
Amir Mahfoozi 7-Feb-12 3:38am    
You're welcome :)
you can use rank over to re order in ranking order here is the detailed method

http://umairaslam.blogspot.com/2011/02/ranking-query.html[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900