Nastaran Hakimi
Nastaran Hakimi

Reputation: 725

Set row number sequentially in matrix table in SSRS report

I have a SSRS report which consists of the matrix table. This matrix has a row Groups called ItemId1. I want to add line number to this matrix. when I add a expression RowNumber(nothing) the results is as follow :

enter image description here

when I add expression RowNumber("ItemId1"), the report is shown as follow:

enter image description here

I want just line number based on the row, I mean I expect line number 2 instead of 7 (or 8)

Upvotes: 1

Views: 10086

Answers (2)

AnkUser
AnkUser

Reputation: 5531

enter image description here

on Right hand side I have grouped by Category and Here is how I solved it

=RunningValue(Fields!category.Value,CountDistinct, "DataSet1")

In your case it shall be

=RunningValue(Fields!ItemId.Value,CountDistinct, "DataSet1")

Upvotes: 0

Alan Schofield
Alan Schofield

Reputation: 21683

You cannot use RowNumber as this looks at the dataset rather than what is displayed. What you actually need to do is get the number of unique ItemID's on or before each group.

This is actually much simpler than it sounds !

You can use RunningValue to do exactly this.

=RunningValue(Fields!ItemId.Value,CountDistinct, "DataSet1")

You will just need to change the dataset name to whatever your dataset is actually called.

Here's the output from a sample report I created. The first column shows a similar result to yours when RowNumnber is used. The second column uses the RunningValue method.

enter image description here

Upvotes: 5

Related Questions