Aerobane
Aerobane

Reputation: 85

SSRS Change Row Color for First Row of Sorting

I have a table that is sorted by Main Tank and would like to make the first row of each sort (where the name of main tank switches to a new tank) to be grey. So if you have 10 rows with only 2 tanks you would have two lines of gray, the first for each new tank. I though I could possibly use RunningValue for this but haven't been able to get that to work. Any suggestions on a function or method I could use for this?

Upvotes: 0

Views: 733

Answers (2)

Tab Alleman
Tab Alleman

Reputation: 31785

Add a partitioned ROW_NUMBER() to the dataset and use it in the background color expression for the row to set the color to gray when the row number = 1.

Upvotes: 0

alejandro zuleta
alejandro zuleta

Reputation: 14108

I think you can achieve that checking if the current value is equal to the previous, in that case you set the background-color the color you want.

I've used this table to test.

enter image description here

Select the row, in Background-color property use this expression:

=iif(
Fields!Tank.Value=previous(Fields!Tank.Value),
"Transparent",
"Red"
)

Replace "Red" for the color you want.

It will produce something like this:

enter image description here

Let me know if this helps.

Upvotes: 2

Related Questions