Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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
  • Hi Anonymous 

    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 

     

2 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous 

    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