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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
PBI_V2
Helper IV
Helper IV

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 %.

PBI_V2_0-1718291268540.png

 


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

PBI_V2_1-1718291338572.png

 


when we select Canada from the slicer then it shows Green

PBI_V2_2-1718291384927.png


when we select France from the slicer then it shows Green

PBI_V2_3-1718291428610.png

 

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

PBI_V2_4-1718291483320.png

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:

PBI_V2_0-1718291796619.png

 

 


Could you please help in resolving the issue.

 

Thanks,

PBI V2

1 ACCEPTED SOLUTION
rajendraongole1
Community Champion
Community Champion

Hi @PBI_V2 - 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)
 
 

rajendraongole1_1-1718292426819.png

 

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

 

rajendraongole1_2-1718292525369.png

Final result

 

rajendraongole1_0-1718292370279.png

 

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

rajendraongole1_3-1718292586654.png

 

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!!

 

View solution in original post

1 REPLY 1
rajendraongole1
Community Champion
Community Champion

Hi @PBI_V2 - 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)
 
 

rajendraongole1_1-1718292426819.png

 

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

 

rajendraongole1_2-1718292525369.png

Final result

 

rajendraongole1_0-1718292370279.png

 

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

rajendraongole1_3-1718292586654.png

 

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!!

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors