Forum Discussion
Thimios
6 years agoHelper III
Measures in Matrix with conditional formating
Hi all, I have the following matrix with a couple of measures. I need to conditionally format the background for each row of the % FOOD COST measure. Existing capabilities allow for conditional form...
- 6 years ago
Hi Thimios ,
You could refer to the following measure:
Measure = VAR a = SELECTEDVALUE ( Table[CATEGORY] ) VAR b = SELECTEDVALUE ( Table[%FOOD COST] ) VAR if1 = ( a = "BURGER" && b < 0.42 ) || ( a = "CLUB" && b < 0.55 ) || ( a = "HOTDOG" && b < 0.4 ) || ( a = "PIZZA" && b < 0.4 ) VAR if2 = ( a = "BURGER" && b >= 0.42 && b <= 0.44 ) || ( a = "CLUB" && b >= 0.55 && b <= 0.57 ) || ( a = "HOTDOG" && b >= 0.4 && b <= 0.42 ) || ( a = "PIZZA" && b >= 0.4 && B <= 0.42 ) RETURN IF ( if1, "green", IF ( if2, "yellow", "red" ) )Then put this measure into conditional formatting.
v-eachen-msft
6 years agoCommunity Support
Hi Thimios ,
Do you mean to get the following result?
Here is the measure:
Measure =
SWITCH (
SELECTEDVALUE ( TestTable[Name] ),
"A", "red",
"B", "yellow",
"C", "green",
"D", "gray"
)
Thimios
6 years agoHelper III
v-eachen-msftI'm afraid not. This is the scenario:
- v-eachen-msft6 years agoCommunity Support
Hi Thimios ,
You could refer to the following measure:
Measure = VAR a = SELECTEDVALUE ( Table[CATEGORY] ) VAR b = SELECTEDVALUE ( Table[%FOOD COST] ) VAR if1 = ( a = "BURGER" && b < 0.42 ) || ( a = "CLUB" && b < 0.55 ) || ( a = "HOTDOG" && b < 0.4 ) || ( a = "PIZZA" && b < 0.4 ) VAR if2 = ( a = "BURGER" && b >= 0.42 && b <= 0.44 ) || ( a = "CLUB" && b >= 0.55 && b <= 0.57 ) || ( a = "HOTDOG" && b >= 0.4 && b <= 0.42 ) || ( a = "PIZZA" && b >= 0.4 && B <= 0.42 ) RETURN IF ( if1, "green", IF ( if2, "yellow", "red" ) )Then put this measure into conditional formatting.
- Thimios6 years agoHelper III
v-eachen-msftWorks like a charm, thank you!
Great to understand the logic behind that and all possible applications.