cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ALemmy
Frequent Visitor

Colour Formatting Dax - SWITCH function

Hi Guys 

 

I keep hitting a brick wall, I have this formula but I keep getting errors OR it only picks up the first condition "Green" and the "Persian Blue" for all my completed items.

 

I am trying to do is get all information marked as complete with "Persian Blue", if it is not marked as complete I need a colour name on the basis of the % of budget used on the work 

 
Between:
0 - 40% Green
41 - 60% Yellow
60 - 79% Orange 
>80% Red
 
Background colour = SWITCH(TRUE(),
[DAX Status]="Complete","Persian Blue",
[% remaining - Report]=or([% remaining - Report]>=0,[% remaining - Report]<0.4),"Green",
[% remaining - Report]=or([% remaining - Report]>=0.41,[% remaining - Report]<0.6),"Lemon",
[% remaining - Report]=or([% remaining - Report]>=0.61,[% remaining - Report]<0.79),"Orange",
[% remaining - Report]>0.8,"Red")
 
Any help you guys can give me will be appreciated - youtube is getting me nothing ha 
 
Thank you 
 
Anne
1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @ALemmy 

Background colour =
SWITCH (
    TRUE (),
    [DAX Status] = "Complete", "Persian Blue",
    AND ( [% remaining - Report] >= 0, [% remaining - Report] < 0.4 ), "Green",
    AND ( [% remaining - Report] >= 0.41, [% remaining - Report] < 0.6 ), "Lemon",
    AND ( [% remaining - Report] >= 0.61, [% remaining - Report] < 0.79 ), "Orange",
    [% remaining - Report] > 0.8, "Red"
)

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

View solution in original post

2 REPLIES 2
NikhilKumar
Super User
Super User

@ALemmy ,

 

Check this - https://community.powerbi.com/t5/Community-Blog/Conditional-Formatting-Using-Custom-Measure/ba-p/139... if this helps you.

 

You can set the MIN and MAX values according to your requirement.

 

Appreciate your kudos!! Please mark my post as solution if this suits your requirement.


Nikhil
Hit the Thumbs-up button if you find this informative!!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!

AlB
Super User
Super User

Hi @ALemmy 

Background colour =
SWITCH (
    TRUE (),
    [DAX Status] = "Complete", "Persian Blue",
    AND ( [% remaining - Report] >= 0, [% remaining - Report] < 0.4 ), "Green",
    AND ( [% remaining - Report] >= 0.41, [% remaining - Report] < 0.6 ), "Lemon",
    AND ( [% remaining - Report] >= 0.61, [% remaining - Report] < 0.79 ), "Orange",
    [% remaining - Report] > 0.8, "Red"
)

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors