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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Conditional Coloring for Pie/donut Chart

Hi everyone.

 

I have a little problem, I have to create some donut chart, but the code colours should be based on the value of a field, these is the table:

ruz_lee_0-1610449519665.png

I have to create differents donut, one for each category, and the Average of rating by each category. The code colour should follow these rules:

If AVG(Rating)<5 then Red

If AVG(Rating) >=5  AND AVG(Rating)<8 Then Yellow

If AVG(Rating) >=8 Then Green

 

I think that I would need a calculated field with these rules, and add this field in the data colors of the object, but I can´t (or I don´t know) create a field calulated with AVERAGE function.

 

Any suggestion? Thanks a lot.

1 ACCEPTED SOLUTION

@Anonymous , check for custom visual. Standard visual not supported yet.

https://appsource.microsoft.com/en-us/marketplace/apps?product=power-bi-visuals

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , As far as I know, conditional formatting is not yet supported on the pie or any other visual that use a legend.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

And any suggestion to use like for example in the conditional formatting with the table object? As you know, a lot things is not possible to do it directly...

@Anonymous , with table visual you can create a color measure, like

Switch(True(),
AVG(Rating)<5 ,"red",
AVG(Rating)<8,"Yellow",
"Green"
)

 

Now in conditional formatting/ background color/ Data color, Under Fx option (Advance) option

Choose - Field value and use this measure.

 

Refer to these blogs for steps -

 

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

My video, that is for unichar and color - https://www.youtube.com/watch?v=veCtfP8IhbI

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Yes, but the problem is that the visual figure should be a pie or donut... 😞

@Anonymous , check for custom visual. Standard visual not supported yet.

https://appsource.microsoft.com/en-us/marketplace/apps?product=power-bi-visuals

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!