Capture Row Number in SSRS Report

266 views Asked by At

I am new to SSRS. This is for a Dynamics CRM report. I have a tablix where I am displaying the row numbers using the RowNumber() function. My question is-Is there a way I can display a particular row number outside the tablix.

For ex- I have table that shows Clothing Items in one column and their colors in the next column. I also have Row numbers populating for this table.

I now want to display the row numbers for all the rows that have Clothing Item= Shirts and Color=Red in a separate text box. If these items are on the 2nd and 4th line of the table, I want the text box to display "2, 4".

I tried using a calculated field but I'm not sure what to put in the formula. I tried looking for functions that capture Row numbers, but couldn't.

1

There are 1 answers

2
Hannover Fist On

If your Row Number is the row of the table, then you could identify the row number using an aggregate function.

Assuming you have Item and Color parameters for the (not necessary, they could be hard-coded), your Text Box expression would use aggregates with the dataset scope.

An IIF would be used to check for the selected Item or Color. Then a MAX aggregate to get correct rows.

=MAX(IIF(Fields!ITEM.Value = Parameters!ITEM.Value, Fields!ROW_NUM.Value, NOTHING), "Dataset1") & 
", " & 
MAX(IIF(Fields!COLOR.Value = Parameters!COLOR.Value, Fields!ROW_NUM.Value, NOTHING), "Dataset1")