Forum Discussion

andrew5083's avatar
andrew5083
Frequent Visitor
5 years ago
Solved

Coniditionally Format Color on Clustered Bar Charts

I'm brand new to Power BI.  We're comparing Power BI's capabilities to our current BI software to see if it may be a viable replacement.  In our current software, it is extremely simple to create custom, color based KPIs on any kind of chart or table.  I've spent the last day researching how to do this in Power BI, but have not found a way to accomplish the same.

 

In my example I have a simple clustered bar chart with three bars showing PYTD Sales, YTD Sales and a YOY Difference.  As shown below, I do not have any fields in the legend which should enable the ability to use conditional formatting options on the Data Colors section of the Format tab.  However, I only have the ability to select static colors.

 

                         

If I create a bar chart with just YOY Diff, I do have the ability to create conditional formatting on the color.  However, it is not efficient to have this data spread across multiple charts.  

 

I've also attempted to create a color measure to use to color the bar, however any chart that has >1 column in it does not have the ability to conditionally format.

 

Any advice is appreciated.

 

 

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    This is unfortunate. I have been working on getting conditional formatting in bar charts for two days now. I only see conditional formatting options in Guage and Funnel charts, but nothing for scatter, bar, clustered bar, etc. I have seen posts all over the web on people applying fx formats to these chart types, but none of the methods work for me in older or recent versions of PBI Desktop and PBI RS Desktop. It isn't due to how I am configuring my measures either.

    Further, I am unable to upvote these on Microsoft Idea, which is likely an issue for others, so these basic features are lacking upvotes I suspect.

    Please add this behavior to all OOtB visualizations. It's a major shortcoming of PBI.

  • littlemojopuppy's avatar
    littlemojopuppy
    Community Champion

    Hi!

     

    You can create a measure assigning the different colors such as the following

     SWITCH (
        TRUE (),
        ISBLANK ( [Projected Active Users % of Target YTD] ), "#FFFFFF00",
        [Projected Active Users % of Target YTD] < .9, "#FF0000",
        [Projected Active Users % of Target YTD] < 1, "#FFFF00",
        [Projected Active Users % of Target YTD] < 1.25, "#00CC00",
        [Projected Active Users % of Target YTD] >= 1.25, "#0099FF",
        BLANK ()
    )

     and then apply it as conditional formatting.

     

    https://docs.microsoft.com/en-us/power-bi/visuals/service-tips-and-tricks-for-color-formatting

    • andrew5083's avatar
      andrew5083
      Frequent Visitor

      littlemojopuppy unfortunantely this doesn't work either.  I attempted this when creating a 'color measure' as referenced in my original post.  However, if there are >1 bar in a bar chart the option to conditionally format any color does not appear.  

      • littlemojopuppy's avatar
        littlemojopuppy
        Community Champion

        It does work if you define the measure properly...have done it in a number of projects I've worked on