Power BI: How to Apply Conditional Formatting to Bar Chart


Often you may want to apply conditional formatting to a bar chart in Power BI so that bars with a value greater than a specific number have one color while bars with a value less than the number have another color:

Power BI conditional formatting for bar chart

Fortunately this is easy to do and the following example shows how to do so.

Example: Apply Conditional Formatting to Bar Chart in Power BI

Suppose we have the following dataset in Power BI that contains information about various basketball players:

Suppose that we would like to create a bar chart to visualize the sum of points scored by each team.

To do so, click the Report View icon on the left hand side:

Then click the icon called Line and stacked column chart under the Visualizations tab.

Then choose Team for the X-axis and Points for the Column y-axis:

This will create the following bar chart that displays the sum of points scored by players on each team:

Now suppose that we would like to apply conditional formatting to the bars such that the bars with a value of 100 or greater are blue and the bars with a value less than 100 are red.

To do so, click the Format your visual icon, then click the dropdown arrow next to Columns, then click the Conditional Formatting (fx) icon:

In the new window that appears, choose:

  • Format style: Gradient
  • What field should we base this on: Points
  • Minimum: Custom value of 99 with a red color
  • Maximum: Custom value of 100 with a blue color

Once you click OK, conditional formatting will be applied such that the bars with a value of 100 or greater are blue and the bars with a value less than 100 are red:

Power BI conditional formatting for bar chart

We have now successfully applied conditional formatting to the bar chart based on the numerical values of the bars.

Additional Resources

The following tutorials explain how to perform other common tasks in Power BI:

Power BI: How to Apply Conditional Formatting to Text Column
Power BI: How to Write an IF Statement
Power BI: How to Write a Case Statement

Leave a Reply

Your email address will not be published. Required fields are marked *