Forum Discussion
Conditional Formatting with a Legend
- 4 months ago
Hi 0Experience
Thank you for the thorough explanation. Currently, in Power BI, when a visual uses a legend for multiple series, the legend determines the color assignment for each series. As a result, conditional formatting for data colors using DAX measures or field values may not be available, as it is overridden by the legend.See this reference: https://learn.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-conditional-formatting#co…
For cases where you need consistent colors across visuals and pages, using a Report Theme (JSON) is recommended. This approach centralizes the color palette and helps maintain consistency, though colors are assigned based on the series order and may change if legend values are filtered.
If you need fully dynamic, data-driven color control while keeping the legend (including in Focus Mode and exports), native Power BI visuals do not currently support this. In such situations, a custom visual like Deneb can be used to explicitly map colors and retain a functional legend.
Reference:https://learn.microsoft.com/en-us/power-bi/create-reports/report-themes-create-custom
If you have any further questions, feel free to reach out and we'll be glad to assist.
Regards,
Microsoft Fabric Community Support Team.
Hi 0Experience ,
The colors are set based on the theme so when you select a specific field the values will have the same color based on the order of the colors selected in this case you are using the base theme for Power BI so when you select the country it will apply the same color consistently to the 1st, 2nd, and so on.
The problem occurs when has you refer apply the legend and then the colors are repeated even when you select different column categories:
Depending on what type of visual you are using you can change this in order to get the condittional formatting.
For example in the case the you show you can make a concatenation of the x-axis instead of using the legend and in that case you can then use the condittional formatting using a table with the expected colors.
Check the video below:
https://www.youtube.com/watch?v=-FG0DSSAr60
- 0Experience5 months agoHelper III
MFelix thanks for your detailed reply and for the examples. Really appreciate it.
However, I don't want to use the concatenation of the x-axis