Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Power BI - Background Conditional color Formatting Issue when we use slicer in the report

Hello All,

We are facing issue with Conditional background coloring when we use slicer in the report.

Background Color Condition:

If Compliance % < 95% then Red color
If Compliance % >= 95% but < 100 % then Amber
If Compliance = 100& then Green Color

 

Below is the sample report which shows region wise Compliance %.

 


Here you can see Australia , Canada & France is in Red But when we select Austraila from the slicer then it shows Green

 


when we select Canada from the slicer then it shows Green


when we select France from the slicer then it shows Green

 

When I select first Australia then Canada then Australia is Green & Canada is red.

Which ever region we select first in the slicer, it will come Green.

 

Below is the conditonal color formatting logic that we are using in the report:

 

 


Could you please help in resolving the issue.

 

Thanks,

PBI V2

  • Hi Anonymous - Can you create a measure specifically for determining the background color based on the Compliance % value.

     

    Create a compliance measure:

     

    ComplianceColor =
    SWITCH(
        TRUE(),
        [profittotal] < 100000, "#FF0000",  // Red
        [profittotal] < 8999998, "#FFA500",  // Amber
        [profittotal] = 100000000, "#008000",  // Green
        "#FFFFFF"  // Default White or any other default color
    )
     
    you can adjust your field in switch statement and add the values like 95, 95,100, 100 and max.
     
    select the table/matrix chart used, go to the format cell elements select the right series column you want to implement conditional formatting 
    select (fx)
     
     

     

    Once selected the fx, choose the field value from format style and add the measure created.

     

    Final result

     

     

    Once selected the category country: no change on the background color in visual.

     

    Try the above logic and let know.

     

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

     

1 Reply

  • Hi Anonymous - Can you create a measure specifically for determining the background color based on the Compliance % value.

     

    Create a compliance measure:

     

    ComplianceColor =
    SWITCH(
        TRUE(),
        [profittotal] < 100000, "#FF0000",  // Red
        [profittotal] < 8999998, "#FFA500",  // Amber
        [profittotal] = 100000000, "#008000",  // Green
        "#FFFFFF"  // Default White or any other default color
    )
     
    you can adjust your field in switch statement and add the values like 95, 95,100, 100 and max.
     
    select the table/matrix chart used, go to the format cell elements select the right series column you want to implement conditional formatting 
    select (fx)
     
     

     

    Once selected the fx, choose the field value from format style and add the measure created.

     

    Final result

     

     

    Once selected the category country: no change on the background color in visual.

     

    Try the above logic and let know.

     

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!