0

I'm working on a report for attendance and building a report for administration that shows students at Risk based on percentage.Want to change the percentage color based on the value for quicker viewing of issues. This is what I have so far but keep getting errors.

=IIf(Fields!absenteeismPercentage.Value <5, "Green"), IIf(Fields!absenteeismPercentage.Value > 5 and (Fields!absenteeismPercentage.Value < 9,"Yellow"), IIf(Fields!absenteeismPercentage.Value > 10,"Red","Black"))

2 Answers 2

1
=IIf(Fields!absenteeismPercentage.Value < 5, "Green", 
    IIf(Fields!absenteeismPercentage.Value >= 5 And Fields!absenteeismPercentage.Value < 9, "Yellow", 
        IIf(Fields!absenteeismPercentage.Value >= 9 And Fields!absenteeismPercentage.Value <= 10, "Red", "Black")))
Sign up to request clarification or add additional context in comments.

Comments

1

Stan's answer is correct but you might find SWITCH easier to read and understand.

=SWITCH(Fields!absenteeismPercentage.Value < 5, "Green",
Fields!absenteeismPercentage.Value < 9, "Yellow",
Fields!absenteeismPercentage.Value <= 10, "Red",
True, "Black" )

SWITCH stops when it finds an expression that returns true, so it can simply the code as you don't need ranges.

So, "Yellow" will be returned is the value >=5 and <9 because the first test (<5) must have failed.

You might need to edit the values as your original code would have returned "Black" if the value was exactly 5.

The final True acts like and ELSE

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.