Add Row Number for grouped data

This article demonstrate how to add a row number for grouped data in SSRS report.

Means separate the row counts based on grouping. Suppose for any product there are five category then row number will be assigned to those categories starting from 1 to 5, and when new product comes then again row number will be assigned for each category from 1 up to number of categories are there in that product.

That would be helpful when you want to see how many category are there in each product, also you can easily point out any category based on row number.

As you can see, here we have a sample report as shown below.

You can see, report data is grouped based on Product.

Lets see the report preview, and you can see report data is grouped by product, and you can see the total amount  by product and category.

Lets add add a row number based on product.

For this first add a new column, right click on Category column and navigate to Insert Column and select Left.

After that you will see, a new column is created.

Now give a name to newly created column as #RowNo.

Once you click on Expression, you will see an expression window opens.

Now go to category section, expand Common Functions then select Miscellaneous category.

After that double click RowNumber that is in Item section.

You will see, an expression there in expression builder, now complete the expression as shown below.


After that click on OK button.

Lets see the output of report in preview page.

You can see, it returns the row number for grouping for products.

You may notice that, for each new product row number again starts from 1 up to number of category are there in that product.


Also Read..

Add Row Number in SSRS Report

Display checkbox for active and inactive values in SSRS report

Show “No Data Found” message when no rows returns in SSRS

Display Running Total/Cumulative Total in SSRS

Display Running Total/Cumulative Total within groupings in SSRS

 109 total views,  2 views today

Leave a Reply

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