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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
TusharPiplani
Frequent Visitor

Need To create conditional formatting for Donut chart for Tied Values

Hi All,

I need to show different shades of Yellow color pallete in donut chart for top 5 categories but I have tied values and they are coming under same color, but the client wants different shades of yellow. 

TusharPiplani_0-1762846987799.png

What I want here is different color for all 5 with different shades of yellow.

1 ACCEPTED SOLUTION

Hi @TusharPiplani 

The issue isn’t with your color SWITCH  it’s that your current rank treats tied values as identical.

To assign different shades of yellow to tied top-5 items, you must generate a rank where ties are intentionally broken.

You can do that by creating a Unique Rank measure that sorts by value first, and then uses a secondary stable key (like Category name) to break ties:

 

Unique Rank =
RANKX(
    ALL('Table'[Category]),
    [YourValueMeasure] * 1.0
        + (1e-10 * RANKX(ALL('Table'[Category]), 'Table'[Category], , ASC)),
    ,
    DESC,
    DENSE
)

 

This guarantees that even if multiple categories have the same value, they will still receive ranks 1, 2, 3, 4, 5 instead of all being Rank 1.

Then your color measure will work correctly:

 

Color =
SWITCH(
    [Unique Rank],
    1, "#FFF7A6",
    2, "#FFE875",
    3, "#FFD84A",
    4, "#FFC61A",
    5, "#FFB800",
    "#D9D9D9"
)

This approach ensures different shades for tied values and keeps the donut chart dynamic for changing Top 5 categories.

I hope this information is helpful. If you have any further questions, please let us know. we can assist you further.

 

Regards,

Microsoft Fabric Community Support Team.

 



 

View solution in original post

17 REPLIES 17
v-karpurapud
Community Support
Community Support

Hi @TusharPiplani 

I wanted to check if you’ve had a chance to review the information provided. If you have any further questions, please let us know. Has your issue been resolved? If not, please share more details so we can assist you further.

Thank You.

v-karpurapud
Community Support
Community Support

Hi @TusharPiplani 

Thanks for reaching out to the Microsoft fabric community forum. 

 

I would also take a moment to thank  @johnbarson5 , @ThomasWeppler  , @PhilipTreacy and @parry2k   , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. 

I hope the information provided helps you to fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you 

 

 

Best Regards, 
Community Support Team  

Hi Team, 

The issue is still not resolved can you please suggest few more options to resolve it?

Hi @TusharPiplani 

The issue isn’t with your color SWITCH  it’s that your current rank treats tied values as identical.

To assign different shades of yellow to tied top-5 items, you must generate a rank where ties are intentionally broken.

You can do that by creating a Unique Rank measure that sorts by value first, and then uses a secondary stable key (like Category name) to break ties:

 

Unique Rank =
RANKX(
    ALL('Table'[Category]),
    [YourValueMeasure] * 1.0
        + (1e-10 * RANKX(ALL('Table'[Category]), 'Table'[Category], , ASC)),
    ,
    DESC,
    DENSE
)

 

This guarantees that even if multiple categories have the same value, they will still receive ranks 1, 2, 3, 4, 5 instead of all being Rank 1.

Then your color measure will work correctly:

 

Color =
SWITCH(
    [Unique Rank],
    1, "#FFF7A6",
    2, "#FFE875",
    3, "#FFD84A",
    4, "#FFC61A",
    5, "#FFB800",
    "#D9D9D9"
)

This approach ensures different shades for tied values and keeps the donut chart dynamic for changing Top 5 categories.

I hope this information is helpful. If you have any further questions, please let us know. we can assist you further.

 

Regards,

Microsoft Fabric Community Support Team.

 



 

parry2k
Super User
Super User

It should depends how you have written your measure. T is hard to tell with a simple answer that is not working, provide bit more context, what have you done, how you are visualization the data, columns and measures etc or provide a sample pbix file.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@TusharPiplani, there is a bit of a hack you can do, although Donut Chart doesn't allow conditional formatting, you can use a tree map, apply rule-based conditional formatting, and then convert it to a donut chart.

 

Color Measure = 
VAR __Rank = [Your Rank Measure] --or whatever measure that you want the color based on
RETURN
SWITCH ( 
    __Rank, 
    1, "Green",
    2, "Yellow",
    3, "Red",
    4, "Grey"
)

 

Create tree map, use chemistry on column and measure on value, go to format pane -> color -> fx

 

parry2k_0-1762904590413.png

 

Pick format style as Field value and color measure in the based on:

 

parry2k_1-1762904644555.png

 

Once conditional formatting is applied, change the tree map to a donut chart, and that will take care of it.

 

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

But this doesn't solves the tied values different color requirement.

TusharPiplani
Frequent Visitor

@Pragati11 can you help here please

johnbarson5
New Member

You can solve this by using field-based conditional formatting instead of a single color scale.
Since the values are tied, Power BI will assign the same shade unless you force different colors through a DAX rule.

Create a simple color measure that assigns a unique yellow HEX code for each rank:

  • Rank 1 → #FFF7A6

  • Rank 2 → #FFE875

  • Rank 3 → #FFD84A

  • Rank 4 → #FFC61A

  • Rank 5 → #FFB800

Then apply it using:

Format → Data Colors → fx → Format by Field value → select your color measure

This forces the donut chart to show different shades even when values are identical.

I had the same issue while charting category usage for a kid-friendly creative game like Toca Boca World , where multiple features had the same numbers. Rank-based color formatting fixed it and made the visualization clearer for the client.

Inthis way if I have tied values they will fall under same color and that is not what we want.

Hi @johnbarson5 

 

Where are you seeing this ?  My Donut visual does not allow CF to be set via fx

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


ThomasWeppler
Impactful Individual
Impactful Individual

Hi Tushar

Select the visual you want to change.

Go to view and click customize current theme.

ThomasWeppler_1-1762848885244.png

 

 

ThomasWeppler_2-1762848921943.png

 

Change the colors to different shades of yellow. If you need to find different shades of yellow that are nice to look at than just google it or ask chatgpt.
I hope this help. 🙂

 

PhilipTreacy
Super User
Super User

@TusharPiplani 

 

The Donut visual doesn't have an option for Cond Formatting.  

 

How are you setting the colors now (in the image you provided)?

 

What about setting colors by hand :

 

PhilipTreacy_0-1762848502316.png

Click on More colors and choose your shades of yellow?  But I guess if you are trying to show Top 5 these categories will change and thus mess up your chosen colors?

 

You can use a Treemap which does allow you to use Conditional Formatting to set colors?

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


I have > 50 categorries can''t define the color to each one them need dynamic on the basis of top 5 categories that keep on changing

 

@TusharPiplani 

 

Yes I said as much in my response.

 

As Donut Charts do not have the ability to apply Cond Formatting via fx rules/measures (as I also pointed out), have you tried the suggestion from @ThomasWeppler ?

 

Or use a Treemap which will allow CF via measures?

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@TusharPiplani 
Have you tried my or johbarson5 solution? They should solve it even when your top 5 changes?

Yes I did as I have several donut chart with different color gradient, That solution didn't work

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.