Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 formatting of the measure without taking in mind the line.
Any ideas?
Solved! Go to Solution.
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.
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"
)
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-msftWorks like a charm, thank you!
Great to understand the logic behind that and all possible applications.
@Thimios , you have to format all columns row is not possible with same conditions
https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values
@amitchandak To put it in terms of your post, Revenue needs to be formatted per Customer. In my case, Revenue needs to have a different color formatting for every single customer.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
101 | |
78 | |
75 | |
49 |
User | Count |
---|---|
145 | |
108 | |
107 | |
89 | |
61 |