Forum Discussion
Conditional formatting on stacked column chart
- 10 months ago
The Power BI Desktop interface won't allow conditional formatting on any core stacked bar/column visuals when multiple measures or a legend field are included (as you've observed).
There is a "hack" which I've used in the past described in this post that involves editing the
visual.jsonfile within the PBIP format. I have tested this myself previously and it appears to work as expected, but it's not "officially" supported.
- Unpivot your data so you have a single measure (Value) and a category column (Status: "Achieved", "To Go").
- Use legend-based coloring: set "To Go" to light gray manually.
- For "Achieved", use a DAX measure to dynamically assign color based on selected company.
- Conditional formatting only works with fields, not multiple measures—so avoid using separate Achieved and To Go measures.
Hi, thanks for your reply. When you use just one measure and put status in the legend, you still don't have the option to apply conditional formatting.
- OwenAuger10 months agoSuper User
The Power BI Desktop interface won't allow conditional formatting on any core stacked bar/column visuals when multiple measures or a legend field are included (as you've observed).
There is a "hack" which I've used in the past described in this post that involves editing the
visual.jsonfile within the PBIP format. I have tested this myself previously and it appears to work as expected, but it's not "officially" supported.- jaryszek9 months agoSuper User
Hello Owen,
did you manage to use a measure for bar charts in stacked bar chart with legend?
How did you do this? It would be exteremely helpful.
Best,
Jacek
- v-sgandrathi10 months agoCommunity Support
Hi BBConsultancy,
You’re right, adding a legend to a stacked column or bar chart disables the conditional formatting (fx) option for data colors. This is a known limitation in Power BI visuals.
As a workaround, you can use a dynamic color measure or a field parameter to control colors based on the selected company.
Alternatively, custom visuals like Deneb or Charticulator allow color assignment through measures or expressions. If you want to use only native visuals, you can create a lookup table that maps each company to a specific color and reference it in your measure to dynamically set the Achieved color, while keeping To Go in light gray. This helps maintain visual consistency even without native conditional formatting when a legend is present.
Thank you and continue using Microsoft Fabric Community Forum.- BBConsultancy9 months agoHelper I
Ideally I would use native visuals only. I am not sure your options would work though as they'd still require the conditional formatting option being enabled. I'll give the solution from OwenAuger a go. Thanks anyway!