Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi Guys,
I am trying to implement workaround for adding conditional formatting colors for clustered bar chart with legend.
There is workaround like here:
So I am trying to implement it...
I have:
where MeterCategory for X-Axis is top 5 filtered.
And have 2 measures:
Sort by Total (ignore legend) =
CALCULATE ( [Total Amortized Cost], REMOVEFILTERS ( RankLegend ) )
RankLegend =
DATATABLE(
"Rank", INTEGER,
"Rank Label", STRING,
"HexColor", STRING,
{
{ 1, "Rank 1", "#E81123" }, -- red
{ 2, "Rank 2", "#107C10" }, -- green
{ 3, "Rank 3", "#0078D4" }, -- blue
{ 4, "Rank 4", "#FFB900" }, -- orange
{ 5, "Rank 5", "#8E8CD8" }, -- purple
{ 6, "Others", "#B3B3B3" } -- gray bucket for >5
}
)
And sorting is working (Compute MeterCategory is the highest one).
But all the stackes within each bar has the same total amortized cost values...
This is my model here:
https://drive.google.com/file/d/14lpEWK-MQ6JMU5_15WVh8Gv22AiGvdpR/view?usp=sharing
Can anybody help?
Best,
Jacek
Solved! Go to Solution.
Hi @jaryszek,
Deneb and Charticulator are both free, open-source visuals for Power BI.
Deneb uses the MIT License, allowing users to customize and create advanced visuals with Vega and Vega-Lite specifications.
Charticulator, from Microsoft Research, is also free and enables users to design custom visuals without coding, either through its web tool or by importing it from AppSource.
Neither tool requires a paid license or subscription, so you can use them freely to build custom Power BI visuals.
Thank you.
Anyone?
Best,
Jacek
Hi @jaryszek,
Currently, Power BI does not allow conditional color formatting within a single bar when a legend field is used.
The colors in clustered or stacked bar charts are determined by the legend categories, so each legend value is shown with the same color throughout the chart. As a result, you cannot apply conditional or rule-based color changes within individual bar segments. This is the intended functionality.
If you want to highlight performance or rankings with color, consider using a treemap or matrix visual, where conditional formatting is available at the cell level.These method offer more flexibility for applying conditional colors beyond the standard legend options.
Appreciate if you could share the feedback on our Microsoft Fabric Ideas. Which would be open for the user community to upvote & comment on. This allows our product teams to effectively prioritize your request against our existing feature backlog and gives insight into the potential impact of implementing the suggested feature.
Ok so to confirm, @danextian method will work only for bar charts without legend?
Best,
Jacek
Hi @jaryszek,
Yes, that's correct, the approach shared by @danextian only works for bar charts without a legend field. When a legend is present, Power BI controls the colors according to the legend categories, which overrides any custom color logic you set. This behavior is intentional and can't currently be changed at the segment level in the same visual.
If you want to distinguish values by rank or condition, you can remove the legend and use DAX or a color mapping table to manage colors. Alternatively, visuals like treemaps, matrices, or tables allow conditional formatting by measure or cell.
Thank you.
Thank you,
what can you recommend from custom visuals or in-build visuals in order to replace clustered bar chart/line chart?
Best,
Jacek
Hi @jaryszek,
Thank you for your followup.
Since clustered bar or line charts don't support conditional color formatting with a legend, you can try custom visuals like Deneb or Charticulator for more control, or use built-in options like treemap, matrix, or combo chart for some conditional formatting features. Deneb is especially versatile for dynamic color logic.
Thank you.
thank you,
this Deneb and Charticulator are paid one?
Best,
Jacek
Hi @jaryszek,
Deneb and Charticulator are both free, open-source visuals for Power BI.
Deneb uses the MIT License, allowing users to customize and create advanced visuals with Vega and Vega-Lite specifications.
Charticulator, from Microsoft Research, is also free and enables users to design custom visuals without coding, either through its web tool or by importing it from AppSource.
Neither tool requires a paid license or subscription, so you can use them freely to build custom Power BI visuals.
Thank you.
Im confused. If you used the total cost legend rank measure, shouldnt you get different values for each category. You used a measure that doesn't reference the rank table.
Sorry for that.
Measured did AI so they are not good.
And I do not know how to write this to achive desired results, this is why I created topic.
Thank you for help,
Best,
Jacek