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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
AllanBerces
Post Prodigy
Post Prodigy

Measure Conditional formatting

Hi good day, can anyone help me to correct my measure  on  contional formatting. I need if the Ratio is below target then Red if above then green and Orange if same.

Mismatch Color_rev = SWITCH(
    TRUE(),
    [Mech_Ratio] && [Scaff_Ratio] && [El_Ratio] > [Mech Target] && [Scaff Target] && [EI Target] , "RED",
    [Mech_Ratio] && [Scaff_Ratio] && [El_Ratio] < [Mech Target] && [Scaff Target] && [EI Target] , "GREEN",
    "ORANGE")
 
Thank you
2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Hi @AllanBerces 

You formula is invalid because of how logical conditions are written. Each condition must be fully specified but you took a shortcut isntead.  [Mech_Ratio] && [Scaff_Ratio] && [El_Ratio] - will return either true or false and you compare that with the second part of the condition which will return either true or false as well. True/False > True/False just doesnt make sense in this context. Try:

Mismatch Color_rev =
SWITCH (
    TRUE (),
    [Mech_Ratio] > [Mech Target]
        && [Scaff_Ratio] > [Scaff Target]
        && [El_Ratio] > [EI Target], "RED",
    [Mech_Ratio] < [Mech Target]
        && [Scaff_Ratio] < [Scaff Target]
        && [El_Ratio] < [EI Target], "GREEN",
    "ORANGE"
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

V-yubandi-msft
Community Support
Community Support

Hi @AllanBerces ,

Thank you for bringing this up, and I appreciate @danextian , @ryan_mayu  valuable input on the logic structure. I’ve tested the full scenario and can confirm that the measure works as intended.
FYI:

Vyubandimsft_0-1755841403288.png

 

I used Field value formatting in Power BI, and the colors display correctly. If you notice gradients or blue tones, please check that the format style is set to Field value, not Gradient.

 

I’ve attached a .pbix file with sample data for your reference. Let me know if you want to adjust the logic or make it dynamic.

 

Regards,

Yugandhar.

View solution in original post

4 REPLIES 4
V-yubandi-msft
Community Support
Community Support

Hi @AllanBerces ,

Thank you for bringing this up, and I appreciate @danextian , @ryan_mayu  valuable input on the logic structure. I’ve tested the full scenario and can confirm that the measure works as intended.
FYI:

Vyubandimsft_0-1755841403288.png

 

I used Field value formatting in Power BI, and the colors display correctly. If you notice gradients or blue tones, please check that the format style is set to Field value, not Gradient.

 

I’ve attached a .pbix file with sample data for your reference. Let me know if you want to adjust the logic or make it dynamic.

 

Regards,

Yugandhar.

danextian
Super User
Super User

Hi @AllanBerces 

You formula is invalid because of how logical conditions are written. Each condition must be fully specified but you took a shortcut isntead.  [Mech_Ratio] && [Scaff_Ratio] && [El_Ratio] - will return either true or false and you compare that with the second part of the condition which will return either true or false as well. True/False > True/False just doesnt make sense in this context. Try:

Mismatch Color_rev =
SWITCH (
    TRUE (),
    [Mech_Ratio] > [Mech Target]
        && [Scaff_Ratio] > [Scaff Target]
        && [El_Ratio] > [EI Target], "RED",
    [Mech_Ratio] < [Mech Target]
        && [Scaff_Ratio] < [Scaff Target]
        && [El_Ratio] < [EI Target], "GREEN",
    "ORANGE"
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian @ryan_mayu @V-yubandi-msft thank you very much for the reply work asi need.

ryan_mayu
Super User
Super User

@AllanBerces 

maybe you can try this. Not sure if I understand your logic clearly, if this does not work ,you can try to change && to || to have a try.

 

Mismatch Color_rev =
SWITCH(
TRUE(),
[Mech_Ratio] < [Mech Target] && [Scaff_Ratio] < [Scaff Target] |&&[El_Ratio] < [EI Target], "RED",
[Mech_Ratio] > [Mech Target] && [Scaff_Ratio] > [Scaff Target] && [El_Ratio] > [EI Target], "GREEN",
[Mech_Ratio] = [Mech Target] && [Scaff_Ratio] = [Scaff Target] && [El_Ratio] = [EI Target], "ORANGE",
"ORANGE" 
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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