Skip to content
Home » Add row number in SSRS report

Add row number in SSRS report

This article demonstrate how to add a row number, or serial number or you can say a Row number column in existing SSRS report.

Although you can also retrieve a serial number from dataset (using T-SQL query), but here we will see how to create row number using expression in SSRS report.




Using row numbers in a report allows you to easily identify specific records, especially when dealing with a large volume of data. This also helps you quickly see the total number of records in the report.

Also in case when you find any mismatches, or data quality issues in any row that you want to cross check with developer team, then it would be easy for you to tell them a row number to check that particular records immediately instead of capturing all records for that row.

As you can see, here we have a sample SSRS report, having four columns as Name, ProductNumber, Size, Class.

Adding a row number 

Now we will add a row number to this report, lets add a blank column just right before the Name column.

Just right click on Name column then navigate to Insert Column then select Left.




Once you select left, you will see a New blank column is added before the Name column.

After that, right click on newly added column then select Expression (fx) from context menu.

Once you click on Expression, you will see a Expression window opens.

Now in Category section, expand the Common Functions category and select Miscellaneous.

After that you will see all the list of Miscellaneous functions are populated in Item section.




You can see a RowNumber function there in list, it returns a running count of all rows in the specified scope, just double click on RowNumber.

You can see an expression for RowNumber  function is created automatically in expression builder, to complete the row number expression just pass the parameter value Nothing in function.

Also instead of going through all these step you can simply write this expression directly in expression editor.

=RowNumber(Nothing)

 

After that click on OK button.

Now go to Preview page, to see the row numbers.

You can see a Row Id column, a row number is generated.




Lets go to the last page of report, and you can see there are 176 records in table.




Also Read..

Parameters in SSRS

Create a SSRS Tabular Report / Detail Report

Create a SSRS Matrix Report

Create a List Report

Keep row header visible while scrolling down, or on each page

Add alternate row background color 

 

Loading

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SQL BI Tutorials

Subscribe now to keep reading and get access to the full archive.

Continue reading