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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register 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
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.