SSRS Comparing 2 rows (new vs old) and highlighting the differences / changes

Jay picture Jay · May 17, 2013 · Viewed 10k times · Source

I have a report which gives the current state of an item, and the previous state of an item and I want to display both rows and highlight the differences. For example:

STATUS    ORDER#   NAME      ADDRESS        QTY       PRICE      TOTAL
new       255      Joe       1 Main St      2          5         10
old       255      Joe       1 Main St      4          5         20  

new       256      Matt      100 Green Ave  5          5         25
old       256      Matt      65 Blue St     5          5         25

So for order 255 I'd like to highlight the QTY and TOTAL values since they changed. For order 256, I'd like to highlight the ADDRESS value.

Does anyone know how I can accomplish this?

Thanks a bunch in advance!!

Answer

StevenWhite picture StevenWhite · May 17, 2013

In the textbox properties go to the Fill tab. For fill color enter an expression like this:

=iif(Fields!GroupID.Value=previous(Fields!GroupID.Value) 
and Fields!Spouse.Value<>previous(Fields!Spouse.Value) 
,Parameters!Color.Value,Nothing)

Change "GroupID" to be your Order# and change the "Color.Value" to the highlight color you want. Note: This will only highlight the second row when it is different from the first, there is no way to highlight the first row as well because there is no "Next" function, just the Previous function. You can use this to either highlight just the cells that are different or the entire row.