Search code examples
sqlsql-serverreporting-servicesssrs-2008ssrs-tablix

Coloring a TextBox in SSRS


I have a table in my report and want to color my Header which is a textbox. Coloring must be conditional and i am having problem in writing expression.

right now i am using

Switch(Fields!Value.Value="196","GREEN",Fields!Value.Value="197","GRAY",Fields!Value.Value="194","RED",Fields!Value.Value="195","RED",Fields!Value.Value="193","RED")

and there are 4 ROWS in the table with following values

  • 197
  • 197
  • 197
  • 196

Using the above expression header is having Gray color.

What i want is that If any of the 4 values is 193 OR 194 OR 195 then the color of the Header must be RED else Green.


Solution

  • This could be a bit gimmick solution, but you could create this inside your dataset query.

    Create a calculated column that is 1 if the specified column is between 193 and 195 and 0 otherwise.

    Then inside your report you can take sum of that column and if that sum is > 0 then you color header red.