Forum Discussion
Need To create conditional formatting for Donut chart for Tied Values
- 9 months ago
Hi Anonymous
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.
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.
- PhilipTreacy9 months ago
Super User
Hi johnbarson5
Where are you seeing this ? My Donut visual does not allow CF to be set via fx
Regards
Phil
- Anonymous9 months agoNot applicable
Inthis way if I have tied values they will fall under same color and that is not what we want.