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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
OneHotEncoder
Frequent Visitor

Conditional Formatting between two bars in bar chart

Hi all,

 

I'm currently trying to do a conditional formatting which compares two bars within a bar chart.

 

Example: I'm sales manager, reviewing the sales targets in thousand € and the achieved sales in thousand € per shop.

I would like to get a quick overview about the best shops. Example below shows the target visual with Shops on the X-Axis and the Sales on the Y-axis.

OneHotEncoder_0-1707475504727.png

 

You can see that the target sales value bar is always the same colour and the achieved sales bar is conditional formatted based on the target. If Sales was achieved, the bar is green, otherwise it is red. Moreover, the whole visual is sorted ascending by the "highest achiever shops."

 

I tried to implement this use-case in PowerBI but does not work. Using only the achieved value bars, I can do conditional formatting in Columns -> Default. So I would see only the achieved bars and they are green / red filled.

 

OneHotEncoder_1-1707475721401.png

 

 

OneHotEncoder_5-1707476180280.png

 

 

As soon as I add the Target values to the Y-axis the conditional formatting for the achieved bars (green/red) drops and I see the following.

 


 Updating Media

 

So visual will look like this:

OneHotEncoder_2-1707475882557.png

 

I could use the "Line and stacked column chart" and put the goal values on the Line Y-axis but this would not fully fit the requirement. Any solution to this topic?

 

@PhilipTreacy new discussion opened for topic https://community.fabric.microsoft.com/t5/Desktop/Conditionally-format-bar-chart-based-on-another-fi...

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @OneHotEncoder,

 

You cannot use condittional formating for a bar chart with two measures or a legend on it since each one will get it's singular color.

 

Have you tried using the error bars?

 

In this example I have create a combo of line and bar chart.

 

Using the error bars was abble to create this look and feel:

MFelix_0-1707482267680.png

 

Se PBIX file attach.,

 

This is only one workaround there are some custom visuals that allows this.

 

Other option can be to create a staked column chart that has each level of the values until your target or above your target.

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @OneHotEncoder,

 

You cannot use condittional formating for a bar chart with two measures or a legend on it since each one will get it's singular color.

 

Have you tried using the error bars?

 

In this example I have create a combo of line and bar chart.

 

Using the error bars was abble to create this look and feel:

MFelix_0-1707482267680.png

 

Se PBIX file attach.,

 

This is only one workaround there are some custom visuals that allows this.

 

Other option can be to create a staked column chart that has each level of the values until your target or above your target.

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.