Search code examples
excelpowerquerypivot-chart

Set specific color for a Legend in a dynamic Pivot Chart


I have a pivot chart with data coming from a Power Query - SQL Source. Colors in Pivot Chart follow a pattern depending on the number of legends. It always starts with light blue (based on my theme choice) but legend values are not static since it is referencing from a live data - Chart 1 starts with <30d and Chart 2 is >=90d, but both are light blue which is confusing.

I am aware of Macros and tried applying it upon opening the Excel but this will not work if the refreshed data changed the number of legends in the chart. (e.g. Chart 2 now has 2 legend values) and it refreshes weekly.

What i'm looking for is a way to bind a color to specific text - <30d is Red for all charts. If there's a documentation about this that doesn't include Macros that will be best. I've tried finding an IF (legend = <30d) in Macro; spent hours already but is still unsuccessful in doing so.

Charts


Solution

  • To anyone with the same issue, i loaded the data from Power Query to a Worksheet and not to a Data Model. Now when i change the color for a legend and the data refreshes, it will not revert to a default color scheme.