Forum Discussion
Dax Conditional Formatting
- 4 years ago
Hi NLewis
I think you're close. Try adjusting to the below:
BackgroundColor =
VAR _1 = [TerminalWeeklyQuality]
RETURN
SWITCH (
TRUE (),
_1 < 0.9599, "RED" ,
_1 < 0.979, "YELLOW" ,
"GREEN" )The logic with the TRUE() removes the need for an IF statement given, and the between parameters (i.e. > and < ) don't need to be applied because everything under 0.9599 can be red, followed by anything under 0.979 being yellow, and everything else green. The logic in the SWITCH ( TRUE () ... tests everything in order from start to end.
So the order is:
1. If below 0.9599 then RED else
2. If below 0.979 then YELLOW otherwise
3. Just make it GREEN and be done with it!
Hope this helps!
Theo
Hi NLewis
I think you're close. Try adjusting to the below:
BackgroundColor =
VAR _1 = [TerminalWeeklyQuality]
RETURN
SWITCH (
TRUE (),
_1 < 0.9599, "RED" ,
_1 < 0.979, "YELLOW" ,
"GREEN" )
The logic with the TRUE() removes the need for an IF statement given, and the between parameters (i.e. > and < ) don't need to be applied because everything under 0.9599 can be red, followed by anything under 0.979 being yellow, and everything else green. The logic in the SWITCH ( TRUE () ... tests everything in order from start to end.
So the order is:
1. If below 0.9599 then RED else
2. If below 0.979 then YELLOW otherwise
3. Just make it GREEN and be done with it!
Hope this helps!
Theo
1 more question...how do I turn this into a pie chart using the formated % values