Forum Discussion
Colors changed in report unexpectedly
- 1 year ago
vipett Yes, I have faced this issue, the colors were jumbled between the report in desktop view and the report in service. I tried setting it manually couple of times but it didn't help. Instead of setting the colors manually in the bar chart I resorted to using Conditional Formatting using a measure.
The measure forces the visuals to use the assigned colors and It is also easy to change the colors of the categories in future without having to revisit all the visuals.
Create a measure like below and add it your fx option under your visuals
Color Format = SWITCH(Products[Category], "Mobile", "#89010A", "Laptop", "#ffffff", "#55f443")Thanks,
Jai
- 1 year ago
Hi vipett
This issue with colors "jumping" or appearing inconsistently is a known limitation in Power BI.
If you're not using a legend to assign colors (based on a dimension like company), Power BI doesn’t lock the color positions reliably – especially in stacked charts.If you're coloring by a measure or category directly on the bar, one workaround is to use conditional formatting to explicitly set the colors.
Unfortunately, if the color logic is driven only by the stacked segments without a legend, there's no native way to ensure stable color assignment.If you're able to share a simplified version of your PBIX file and a description of the desired outcome, I’d be happy to think of an alternative visual solution.
In many cases, stacked bar charts are not ideal for reading exact values or comparing across groups – especially when showing absolute values. They can even be misleading depending on how the data is laid out.If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Hi again,
I did some testing, if I remove my measure I see the list of all companies in that region with their respective color to the left.
When I add my measure, only the companies with 1,2,3 have values, so they retain their colors from the order (see second picture).
Is there a way to "reset" the assignment of colors based on which ones have values?
The measure is
Hi vipett ,
Thanks for the detailed follow-up and testing.
Since you're using Company Name in the legend, the inconsistent color assignment might be due to a known Power BI limitation - colors can shift when some categories return BLANK(), as Power BI still includes them in the legend and color mapping.
As you noticed, even if a company has no values, Power BI still reserves a color for it. So the companies with visible values start picking up colors further down the theme sequence. Switching from Company Name to Company ID changes the internal order temporarily, which is why the colors may appear correct in some selections but not consistently across all regions.
To answer your question - there’s no built-in way to reset color assignments based only on non-blank values. Power BI doesn’t dynamically exclude legend entries based on whether the measure returns a value.
The most reliable workaround is to use conditional formatting via a measure, as suggested earlier. This ensures each company gets a consistent color regardless of slicer selections or data visibility.
Hope this helps. Please reach out for further assistance.
Please consider marking the helpful reply as Accepted Solution and giving kudos to assist others with similar issues.
- vipett1 year agoHelper III
Thanks, I resorted to manual colors for now, let's see if that is sustainable!
- v-veshwara-msft1 year agoCommunity Support
Glad to hear you've found a workable approach for now! If you ever decide to switch to a more dynamic setup, conditional formatting remains a good option to ensure consistent colors across slicer selections.
Also, if any of the replies above were helpful, please consider marking one as the Accepted Solution - it helps others in the community find answers more easily.
Best Regards,
Vinay.