Forum Discussion

Krushnab_85's avatar
Krushnab_85
Regular Visitor
1 year ago
Solved

Need a help on conditional formatting

Hi i am using stacked bar chart in that i need y axis values's font color should be dynamic.
For example if i put no of registrations on x axis and hospital name on y axis. if any hospital has 0 no of registrations i need his name with different color. I tried but its not working.. Plese someone help.

  • v-aatheeque's avatar
    v-aatheeque
    1 year ago

    Hi Krushnab_85 
    Thanks for reaching out to Microsoft Fabric Community Forum.
    grazitti_sapna Thanks for your prompt response. In addition to that 

    • Currently, Power BI does not support conditional formatting for Y-axis labels (like hospital names) in built-in visualizations such as stacked bar charts. we cannot dynamically change the font color of axis labels based on values like the number of registrations.
    • However, as a workaround, you can apply conditional formatting to the bars themselves. For example, you can color the bar red when the number of registrations is 0 β€” this visually highlights those hospitals even though the Y-axis label color remains unchanged.

    Below is the expected output : 

    If a community member's response addressed your query, please consider marking it as Accepted Answer and click Yes if you found it helpful.

    If you have any further questions, feel free to reach out.
    Thank you for being a valued member of the Microsoft Fabric Community Forum!

     

6 Replies

  • Hi Krushnab_85 ,

    You're on the right track! In Power BI, you can apply conditional formatting to certain elements, but unfortunately, dynamic font color for the Y-axis labels (like hospital names on the Y-axis in a stacked bar chart) is not natively supported as of now

    BUT β€” here's what you can do to work around it and still achieve a very similar result.

    RegistrationFlagColor =
    IF(SUM(Registrations[Count]) = 0, "Red", "Black")

    In a Table visual, add:

    • Hospital Name

    • Registration Count

    Apply conditional formatting to the Hospital Name column:

    • Click the column dropdown > Conditional formatting > Font color

    • Choose Format by = Field value, and pick RegistrationFlagColor

     

     

    🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
    πŸ’‘ Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
    πŸŽ– As a proud SuperUserand Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
    πŸ”— Curious to explore more? [Discover here].
    Let’s keep building smarter solutions together!

    • Krushnab_85's avatar
      Krushnab_85
      Regular Visitor

      Hi GR  Thanks for replying.. Its not working can you please recheck and if it works share me the file

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

        Hi Krushnab_85 
        Thanks for reaching out to Microsoft Fabric Community Forum.
        grazitti_sapna Thanks for your prompt response. In addition to that 

        • Currently, Power BI does not support conditional formatting for Y-axis labels (like hospital names) in built-in visualizations such as stacked bar charts. we cannot dynamically change the font color of axis labels based on values like the number of registrations.
        • However, as a workaround, you can apply conditional formatting to the bars themselves. For example, you can color the bar red when the number of registrations is 0 β€” this visually highlights those hospitals even though the Y-axis label color remains unchanged.

        Below is the expected output : 

        If a community member's response addressed your query, please consider marking it as Accepted Answer and click Yes if you found it helpful.

        If you have any further questions, feel free to reach out.
        Thank you for being a valued member of the Microsoft Fabric Community Forum!