Adding a Rank to sorted groups

  • Hi,

    I'm new to this forum. I receive the daily emails which I often find informative but have never ventured a request for assistance before.

    I am trying to add group ranking to a report automatically generated and exported via Excel Email from Reporting Services. I need to replicate an existing manually generated Excel workbook which includes a Rank against each row. I cant seem to find a way of doing this automatically.

    The data might look like this.

    Rank Group Name Value

    1 Top Group 1234.00

    2 Second Group 788.50

    3= Third Group No 1 500.00

    3= Third Group No 2 500.00

    5 Last Group 350.67

    This is just a made up example but the excel Rank function does exactly this and users have come to rely on it.

    Can anyone be of any assistance?

  • select rank() OVER ( partition by group_name ORDER BY group_name ) as rank, group_name, value, from group

    Try the above code for getting rank.

  • Thanks Gauthama,

    I will try this syntax.

    I have not used Partions before so it may take a little while to work it out.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply