Add alternate row background color on a matrix

For Simple tables (Tablix) the alternate color formula is:

=iif(rownumber(nothing) Mod 2, "White", "#f5f4e9")

 

I have a table matrix that I would like to alternate the row color, the problem is that multiple cells shift color around due to the matrix data grouping. I found  a workaround.

I will not display report data images due to data privacy, but I will explain the process as much as I can.

First; create a column in the report outside the grouping, I recomend at the end of the report; this will be our guide:

alternaterowbackgroundsample1

add the following expression: Remember the Field name we will call it TEXTBOX39

=iif(RunningValue(Fields!THISISTHEROWGROUPINGTHATALTERNATES.Value,CountDistinct,Nothing) Mod 2, "White", "#f5f4e9")
Keep in mind that THISISTHEROWGROUPINGTHATALTERNATES references A in the image below; (Inner Group Field Value)

alternaterowbackgroundsample2

Now hide the column

alternaterowbackgroundsample3

Perfect, now all you have to do is set your background color on the row to:

=REPORTitems!Textbox39.Value
alternaterowbackgroundsample4

And that should do it 🙂

Related Posts

No Comments Yet.

Leave a reply

You must be logged in to post a comment.


Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /homepages/35/d428352912/htdocs/WilliamMendoza/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048