Forum Discussion
Measure for coloring coding when selecting multiple items in the same slicer
Hi,
I need to create a measure for color coding.
There is one table and one slicer on my page where four risk ratings can be selected in the slicer: Critical, High, Medium, Low.
Multiple risk ratings can be selected at the same time in this slicer.
On the same page, I want to use the measure that only when critical and high have been selected, that if the value is larger than 5%, there is a red color font in my table. All other combination of options should not display this red color (for example when selecting critical,high and low simultaneously, there should NOT be a red color font displayed).
I tried to write an even more basic measure, that when selecting high and critical there should be a 1 displayed and otherwise 2 (I know this is not the complete solution but only the first part):
Measure colorcoding =
SWITCH(TRUE(),
SELECTEDVALUE(Table[Risk]) = "Critical" && SELECTEDVALUE(Table[Risk]) = "High", 1,
2)
What measure would I have to write?
Thank you for your help!
3 Replies
- amitchandakSuper User
Anonymous , based on what I got try like
Measure colorcoding =
SWITCH(TRUE(),
SELECTEDVALUE(Table[Risk]) = "Critical" && SELECTEDVALUE(Table[Risk]) = "High" && [measure] >.05 , "Red",
"green")You can use this measure in conditional formatting using field value option
- AnonymousNot applicable
Thank you for your reply. I have two questions about this:
1) What would [measure] be?2) I see you use the same beginning as my measure:
However this simple measure put in a table (just to test it if it works before even going to the color coding part) does not even work in the table:
"SWITCH(TRUE(),
SELECTEDVALUE(Table[Risk]) = "Critical" && SELECTEDVALUE(Table[Risk]) = "High", 1, 2)"Can you please let me know, what goes wrong there with this subformula?
- AnonymousNot applicable
Hello Anonymous
You can try the below code.ColorCoding =
VAR CriticalandHigh =
CALCULATE(
COUNT( table[risk] ),
table[Risk] IN {'Critical','High'},
table[values] > 5
)
RETURN
IF(
CriticalandHigh > 0,
1,
0
)Please apply the formatting on the 1.
If it doesn't work as expected. Could you please share the sample data after removing the sensitive data?