Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
BaronSdG
Resolver II
Resolver II

Conditional formatting not working with SWICH

Hi all,

 

I have created the following switch to convert letters into numbers, thinking this would allow me to apply a conditional formatting to the first column by values without any issues. Problem is, the formatting is not working.
 
This is the formula I use to convert letters into numbers and it is working as  intended as you can see from the pic
isStatus_Color_Background_BetaOrPlanned = SWITCH(components[status], "b", 2,"s", 1, "p",0 )

image.png

 

From the table above, you can see the first column is colored orange, but it should be white.

Here below is the conditional formatting that I have set up. I have also tried changing the summarization to max and other parameters without success.

 

image.png

 

Any help?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@BaronSdG , create measure like and try conditional formatting with field value option

 

isStatus_Color_Background_BetaOrPlanned = SWITCH(max(components[status]),

"b", "red"

,"s", "green"

, "p","Blue" )

 

refer for steps

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@BaronSdG , create measure like and try conditional formatting with field value option

 

isStatus_Color_Background_BetaOrPlanned = SWITCH(max(components[status]),

"b", "red"

,"s", "green"

, "p","Blue" )

 

refer for steps

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

Also, why do I need to use MAX in the formula?

Thanks!

 

I thing to clarify, the measure must be in the table with the filtering letters, otherwise for some reason it doesn't work (the table in the picture I posted was with the actual data), otherwise it doesn't work

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.