RowNumber Function in SSRS

RowNumber Function
RowNumber Function


Lets see what is RowNumber function in SSRS and a simple example to demonstrate the same. This RowNumber function returns the row number for every row with in the dataset. You have to pass the scope for which you wish to create row numbers.  PFB the syntax for the same –


Scope – This tell the server when to RESET the running count. If you pass DATASET name as SCOPE then it will not RESET until the all the items in the DATASET get over. Similarly if you secify a GROUP then the running count will not reset until all the rows items in the group is completed and it will repeat the same for all the groups. You can provide anyone of the below given objects as SCOPE of the function.

1) Dataset

2) Group

3) DataRegion

4) Nothing

If you provide NOTHING then it will take the OUTERMOST data region and will provide Running Count of the rows. Lets see an example on how to to get the Row Number of a SSRS report using ROWNUMBER Function. PFB the expression I am using to get the row number of each row of the data region.


PFB the SC which displays the output of the expression given above.


RowNumber Function
RowNumber Function

You may be wondering “Why I need this ? ” and the answer is – There are many scenarios where you need this and lets discuss about one here. Lets say my requirement is to COLOR alternate rows in one color and in this case I can make use of ROWNUMBER Function to achieve the same. PFB the expression I have to use to achieve the given requirement.

=iif(RowNumber(Nothing) Mod 2,”Green”,”Yellow”).

PFB the steps you have to follow to achieve the same.

1) Select entire row.

2) Press F4(Properties Window).

3) Select BackColor Property and click on Expression.

4) Add the above given expression as shown below.

RowNumber Function
RowNumber Function

5) Preview report and you can see the report like given below.

RowNumber Function
RowNumber Function

You can use the same expression in many places like for changing font color,font weight,border color … So this is very useful function in designing your report.

That’s it, Happy Coding !!


Roopesh Babu V


  1. Hi Rupesh,

    Your articles are really very good and helpful.
    Can you please post something on SSRS reports with parameters using more than one stored proc.

    Please help me out.

    Thanks in Advance.

  2. Hi Roopesh,

    could u please explain the SSRS Reports Deployed in Sharepoint..

    Thanks in Advance,


  3. online edd no dissertation
    [url=””]doctoral dissertation help reference[/url]
    chapters writing room

  4. perseverance and critical thinking
    [url=””]synonym for critical thinking[/url]
    what does critical thinking mean

  5. mba dissertation writing services
    [url=””]dissertation introduction[/url]
    best dissertation help services

  6. dissertation help galway
    [url=””]mathematics dissertation help[/url]
    how to write a dissertation proposal

  7. writing services
    [url=””]writing phd dissertation[/url]
    dissertation proposal methodology example archived

  8. cheap dissertation help in los angeles
    [url=””]writing your dissertation[/url]
    tips for writing a dissertation

  9. BlueChew brings all of the convenience of a good telemedicine provider you can consult with a BlueChew-affiliated doctor for free from the comfort of home and never travel to a doctor s office or pharmacy to get your ED treatment precio priligy 30 mg

  10. with midnight raids and chat-room traps, egypt launches sweeping crackdown on gay community
    [url=””]gay advise chat[/url]
    gay random chat

  11. Whoa many of superb info.
    write an argument essay [url=][/url] custom dissertation writing service

  12. Typically, these patients have normal male external and internal genitalia and a normal hormonal profile. tamoxifen weight gain Another placebo-controlled trial in 60 PCOS-affected subjects found 250 mg magnesium oxide per day for eight weeks increased LH levels and reduced BMI but did not affect markers of glucose or lipid metabolism, or multiple indices of hormonal status.

  13. Whoa a lot of good facts.
    how to write a good cause and effect essay [url=]good college application essays[/url] dissertation writers online

  14. Kudos! I enjoy this!
    how to write five paragraph essay [url=]personal essay for college application[/url] cheap resume writing services

  15. Cheers, Quite a lot of knowledge.
    freelance essay writing [url=]colleges that don t require essays[/url] best custom essay writing service

  16. Awesome information. Kudos!
    write an essay introduction [url=][/url] medical school personal statement writing service

  17. Incredible tons of fantastic info!
    canadian prescriptions [url=]international drug mart canadian pharmacy online store[/url] canadian pharmaceuticals online safe

  18. You reported it fantastically!
    how to write the conclusion of an essay [url=]essay writing services[/url] best personal statement writing services

  19. Information clearly used!.
    best non prescription online pharmacies [url=]best canadian online pharmacies[/url] canadian online pharmacy

  20. Cheers, Wonderful information!
    writing a narrative essay [url=][/url] custom academic writing

  21. Amazing a good deal of beneficial material.
    online pharmacies no prescription [url=]canada pharmacies online prescriptions[/url] pharmacy tech


Please enter your comment!
Please enter your name here

51 + = 53