Blog Post

Power BI Community Blog
2 MIN READ

Power BI: Conditional formatting the Pie Visual

amitchandak's avatar
amitchandak
Icon for Super User rankSuper User
5 years ago

Objective: 

Conditional formatting on Pie Visual 

 

Steps:

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

 

But we have one for Bar Visual 

 

 

Let us do some scale based coloring on Bar Visual 

 

 

 

We can see Bar is having conditional formatting 

 

 

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

 

 

 

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. 

 

 

 

The same step, change the visual to pie now 

 

 

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

Published 5 years ago
Version 1.0

4 Comments

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    This is not working anymore with the new version :S