TheSQLLearner
TheSQLLearner

Reputation: 51

How to color a column's value based on a null value of other columns in SSRS?

Column A in my report holds values say, 2, 3, 4, 5. Columns B and C hold values that place limits on what Column A's values should be. For example:

Column A | Column B | Column C

2                 1                 3
3                                  
4                 1                 9
5                 8                 12

I would like the values 2 and 4 in Column A to be green because they fall within the limits, 5 to be red since it falls outside of the limits and 3 to be black since it has no limit restrictions. How do you code this in the Expression Tab for Fonts in SSRS?

Upvotes: 0

Views: 80

Answers (1)

Jayvee
Jayvee

Reputation: 10875

This should work:

=IIF(ColumnA < ColumnB Or ColumnA > ColumnC, "Red", IIF(ColumnB=Nothing , "Black","Green"))

Or

Switch(
ColumnB= Nothing, "Black",
ColumnA < ColumnB, "Red",
ColumnA > ColumnC, "Red",
True, "Green"
)

Upvotes: 1

Related Questions