Changing font color when comparing fields in Report Builder 3.0

1.6k views Asked by At

Report Builder 3.0 I have 2 columns - one is est hours - one is act hours I want to change the hours in the act to "red" when it is higher than the estimate hours

I have tried the following

IIF(Fields!AcutalHours.Value > Fields!Estimate_Hours.Value "Red"

and I have tried the following

=Switch(Fields!Estimate_Hours.Value < Fields!AcutalHours.Value, "Black"), =Switch(Fields!AcutalHours.Value > Fields!Estimate_Hours.Value, " Red ")

I am using the font expression

2

There are 2 answers

0
Dan Scally On

Are the fields definitely Numeric? Try converting them to Int to ensure it's comparing them as numbers.:

=Iif(CInt(Fields!ActualHours.Value) > CInt(Fields!Estimate_Hours.Value), "Red", "Black")

0
callisto On

You can add a new calculated field to your Dataset in ReportBuilder with a formula like this:

=IIF(InStr(Fields!Original.Value,Fields!Updated.Value)>0, "White","Red")

Once that is done, Select the properties of the field that needs to be formatted, select fill, formula and set the expression for the BackgroundColor to

=Fields!MyCustomDiffField.Value

I use this method of formatting in Report Builder 3.0