Forum Discussion

BBConsultancy's avatar
10 months ago
Solved

Conditional formatting on stacked column chart

Hi All,

 

I want to create a 100% stacked bar chart that shows the progress per employee on target. I want the 'achieved' part of the bar to be colored, and the 'to-go' part in light gray.

 

However, the colored part of the bar should change based on the selected company. The issue is that the conditional formatting option for bar colors dissappears when you add multiple measures (or a bar legend) to the visual.

 

It's a nice to have and not a must for this case, but i'm still curious if anyone found a workaround for this.

  • OwenAuger's avatar
    OwenAuger
    10 months ago

    Hi BBConsultancy 

    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.json file within the PBIP format. I have tested this myself previously and it appears to work as expected, but it's not "officially" supported.

9 Replies

  • Shahid12523's avatar
    Shahid12523
    Community Champion

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

    • BBConsultancy's avatar
      BBConsultancy
      Helper I

      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. 

      • OwenAuger's avatar
        OwenAuger
        Super User

        Hi BBConsultancy 

        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.json file within the PBIP format. I have tested this myself previously and it appears to work as expected, but it's not "officially" supported.

  • v-sgandrathi's avatar
    v-sgandrathi
    Community Support

    Hi BBConsultancy,

     

    Just wanted to follow up and confirm that everything has been going well on this. Please let me know if there’s anything from our end.
    Please feel free to reach out Microsoft fabric community forum.

     

    Thank you.