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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

amitchandak

Power BI: Conditional formatting the Pie Visual

Objective: 

Conditional formatting on Pie Visual 

 

Steps:

If we open pie data color, there is no option for conditional formatting.

Screenshot 2021-02-23 11.34.33.png

 

But we have one for Bar Visual 

 

Screenshot 2021-02-23 11.34.45.png

 

Let us do some scale based coloring on Bar Visual 

 

Screenshot 2021-02-23 11.38.26.png

 

 

We can see Bar is having conditional formatting 

 

Screenshot 2021-02-23 11.35.06.png

 

Now change it to pie. It takes the color for each brand 

 

Screenshot 2021-02-23 11.35.23.png

 

 

But, what I want is a fixed color for each brand. So I created a color measure 

Switch( true(),
max('Item'[brand]) = "Brand 1" , "red",
max('Item'[brand]) = "Brand 2" , "blue",
max('Item'[brand]) = "Brand 3" , "green",
max('Item'[brand]) = "Brand 4" , "gray",
max('Item'[brand]) = "Brand 5" , "yellow",
max('Item'[brand]) = "Brand 6" , "orange",
max('Item'[brand]) = "Brand 7" , "brown",
max('Item'[brand]) = "Brand 8" , "Cyan",
max('Item'[brand]) = "Brand 9" , "Tan",
max('Item'[brand]) = "Brand 10" , "Violet",
max('Item'[brand]) = "Brand 11" , "Gold",
"silver"
)

 

Now I can create a bar or table visual and use that using the "Field Value" Option, and choose this measure. 

 

Screenshot 2021-02-23 11.44.18.png

 

 

The same step, change the visual to pie now 

 

Screenshot 2021-02-23 11.45.25.png

 

You can watch the video for detailed steps 

 

 

Let us know what you think about this.

 

You can get all my posts at https://community.powerbi.com/t5/Data-Stories-Gallery/Blog-Analysis/m-p/1265567#M4403

 

You can also follow my YouTube channel (YouTube) and LinkedIn (profile) to get information on the upcoming webinars

Comments

Hey Amit this is great idea

Anonymous

This is not working anymore with the new version :S 

hi @amitchandak,

 

This is an amazing tip!

I was having problems when using top N filter in a Donut chart because it was changing colors as I made selections in different slicers. So I used your tip together with RANKX function and it worked like a charm 🙂

Thank you!