Row Numbering Issue for Grouped Data in SSRS

Issue:

In SSRS if we are using an aggregate function in a group at the Tablix level, then you may realize that the simple row numbering function does not give a current sequential ranking. Using the function RowNumber(Nothing) gives something like this.

Incorrect Row Numbering

Using RowNumber(“GroupName”) would also give an incorrect row numbering and look something like this.

Incorrect Row Numbering 2

This is because RowNumber does not actually give the row count. Rather it counts the incidences of the data in the group and returns that value.

Solution:

We can use the “RunningValue” function in SSRS. The format for the expression would be.

=RunningValue(<Grouped field>,CountDistinct,”<DataSet>”)

Eg: =RunningValue(Fields!Name.Value,CountDistinct,”Accounts”)

This would return something like this.

Correct Row Numbering

 

This should fix your issue!


Share Story :