0

I have an SSRS Expression that I need to color code if the Score is < .85 font color is Red otherwise black. The output displays a 1 decimal place value (eg. 85.0%, 83.1%'), but when the value is .849 it is changing the color to red because it is rounding the value to 85.0% and turning it to font color red. Is there a syntax that it will not change the font color to red when the value is 85.0%?

=IIF(Fields!CompositeScore.Value < .85,"Red","Black")

enter image description here

Arsee
  • 651
  • 2
  • 11
  • 36

1 Answers1

0

I think something isn't quite right in your scenario since 0.849 would be 84.9% (rounded to a single percentage decimal point). Assuming that you are actually rounding the decimal value to three decimal places, then the value 0.8497 would create the issue you are describing.

For the scenario CompositeScore = 0.8497, I would apply the same rounding logic to your color expression that the display is performing like so:

=IIF(Round(Fields!CompositeScore.Value * 100)/100 < 0.85, "Red", "Black")

Since SSRS only has a function to round a decimal to the nearest integer (no ability to specify precision) you have to first multiple the number by 100 to get the two decimal precision and then divide by 100 again to return back to the original value. More details can be found at the provided link:

MSDN Article Describing Rounding Precision

Daniel
  • 1,364
  • 1
  • 19
  • 34