Ash Atre
Ash Atre

Reputation: 305

column value comparison and fill color change based on the expression

I am comparing 2 similar tables from different data warehouses and writing a report to highlight the discrepancies based on the differences. I would like to highlight the column values of the 2 fields if they are different. So, I am trying to write the Fill COLOR Expression which can change the color based on the value in the column.

I have tried writing some expressions.

Below are the examples:

I tried :

=IIF(Fields!DB1.Value=”NULL”,”Red” ,”White”) Or IIF(Fields!Db2.Value=”NULL”,”Red” ,”White”) Or IIF(Fields!DB1.Value=Fields!DB2.Value,"NO Color","Red")

--Not Working

=IIF(Fields!DB1_Number.Value<>Fields!DB2_Number.Value,"NO Color","Red")

-- Not Handling NULL

There are no error. It is just that the code is not behaving as per the intention.enter image description here

Upvotes: 0

Views: 886

Answers (1)

Strawberryshrub
Strawberryshrub

Reputation: 3399

Just use the second expression and check for Null before:

=IIF(IsNothing(Fields!DB1_Number.Value) And IsNothing(Fields!DB2_Number.Value), "Red", 
     IIF(Fields!DB1_Number.Value <> Fields!DB2_Number.Value,
         "White",
         "Red")
     )

Upvotes: 0

Related Questions