Forum Discussion

em12340's avatar
em12340
Frequent Visitor
7 years ago
Solved

Background Color Change based upon Value

Hi PowerBi Community,

 

I have a matrix table that where the values are colour coded based on three categories Engagement, Known, and Outcomes, I am able to colour code the values but for the cells that have no value dont get colour coded since they dont contain any data. Is there a way i can colour code them as well? Thanks in advance ! 

  • Anonymous's avatar
    Anonymous
    7 years ago

     

     

    Hi,

     

    just make a new column with similar concept as explained below( you have to apply either if or switch function) :-

     

    I'm using IF condition/function

     

     New_Column = if([category = "engagement" , 1,
                                    if(([category = "Known", 2,
                                        if(([category = "Outcomes", 3,0))

    Now go to condition backgroubd formating (click on field column in which you want to do background formatting)

    Please see the below picture

     

    Now in the conditional background formating use the new column to make the rules.

    Select Format BY to rules

    Select based on Field to New_Column

     

     

     

    YOU WILL GET SIMILAR RESULT AS BELOW:

     

     

    HOPE THIS WILL HELP

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

     

     

    Hi,

     

    just make a new column with similar concept as explained below( you have to apply either if or switch function) :-

     

    I'm using IF condition/function

     

     New_Column = if([category = "engagement" , 1,
                                    if(([category = "Known", 2,
                                        if(([category = "Outcomes", 3,0))

    Now go to condition backgroubd formating (click on field column in which you want to do background formatting)

    Please see the below picture

     

    Now in the conditional background formating use the new column to make the rules.

    Select Format BY to rules

    Select based on Field to New_Column

     

     

     

    YOU WILL GET SIMILAR RESULT AS BELOW:

     

     

    HOPE THIS WILL HELP

  • em12340  you should be able to do so, could you provide info how you are using backgroun colors now since there are many ways to do so, it will help to provide the solution.

    • em12340's avatar
      em12340
      Frequent Visitor

      i have a measure written like this,

      SWITCH(TRUE(), MAX(Engagement[Type]) = "Outcome",1,MAX(Engagement[Type]) = "Known",2,MAX(Engagement[Type]) = "Engagement",3)
      and i wouldve asssumed this would have colour coloded all values under those cateogry, but wher there are blanks there is
      no data so it doesnt colour code it , thats the problem i am having
      • parry2k's avatar
        parry2k
        Super User

        em12340  may be add final condition when it is not any of those values

         

        SWITCH(TRUE(), 
        MAX(Engagement[Type]) = "Outcome",1,
        MAX(Engagement[Type]) = "Known",2,
        MAX(Engagement[Type]) = "Engagement",3,
        4)