Forum Discussion

vipett's avatar
vipett
Helper III
1 year ago
Solved

Colors changed in report unexpectedly

I have a report with two stacked bar charts and in total it is about ~50 companies. In one slicer I choose a region and this narrows it down to between 1-5 companies. In my report I have a theme wi...
  • Jai-Rathinavel's avatar
    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

  • Ritaf1983's avatar
    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