Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Conditoinal Formatting on Percent Field Not Working Expand / Collapse
Posted Tuesday, December 10, 2013 6:46 PM


Group: General Forum Members
Last Login: Tuesday, December 10, 2013 6:40 PM
Points: 23, Visits: 161
Alright, I'm feeling really dumb having to ask this question as i've done this a thousand times, however I can't seem to get this to work and it's driving me crazy.

I have a field containing metrics which are formatted to percent with two decimal places. The data type of the field is FLOAT in the database. I'm trying to add conditional formatting so that the text will be red or green depending whether the metric is less than or lower than a certain value. Right now I have this in the color property -

=SWITCH(SUM(Fields!MyVal.value) > .95, "Green", "Red")

This doesn't work. I've tried different variations on the numbers including > 0 but the formatting just doesn't work. Obviously i'm not recalling how to do this properly and I know this is easy which is making me further frustrated.

What am I missing here?

EDIT: I'm going to edit to say that i've discovered that a nested IIF statement works, but I don't understand why that works and the SWITCH doesn't.

Post #1521721
Posted Wednesday, December 11, 2013 6:26 AM



Group: General Forum Members
Last Login: Today @ 9:49 AM
Points: 6,798, Visits: 6,272
It is because switch works with expression/object pairs, you need to write it like this

=SWITCH(SUM(Fields!MyVal.value) > .95, "Green", True, "Red")

Far away is close at hand in the images of elsewhere.


Post #1521861
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse