Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join 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.

Reply
jaryszek
Memorable Member
Memorable Member

How to add conditional color formatting for clustered bar chart with Legend?

Hi Guys, 

I am trying to implement workaround for adding conditional formatting colors for clustered bar chart with legend.
There is workaround like here:

jaryszek_0-1760079658274.png

Topic: https://community.fabric.microsoft.com/t5/Desktop/How-to-conditional-format-colors-of-stacked-cluste...


So I am trying to implement it...

I have:

jaryszek_1-1760079712902.png


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...

jaryszek_2-1760079800095.pngjaryszek_3-1760079810350.png

This is my model here:
https://drive.google.com/file/d/14lpEWK-MQ6JMU5_15WVh8Gv22AiGvdpR/view?usp=sharing

Can anybody help?

Best,
Jacek





 

1 ACCEPTED 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.

View solution in original post

10 REPLIES 10
jaryszek
Memorable Member
Memorable Member

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.

Fabric Ideas - Microsoft Fabric Community

Thank you.

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.

danextian
Super User
Super User

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.

danextian_0-1760091158988.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.