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 a row number in report you can easily identify any particular records in report, sometimes, it happens when you have too many records in report. You can easily see that how many records are there in report.
Also in case when you find some mismatch, or data quality issue 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.
After that click on OK button.
Now go to Preview page, to see the row number.
You can see Row Id columns, row number is generated.
Lets go to the last page of report, and you can see there are 176 records in table.
8,945 total views, 6 views today