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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Gianlucariotti
Regular Visitor

Horizontal bar charts with custom center line

Hi everyone,

I'm trying to replicate in Power BI a visual I had no problems creating in excel.

It's a horizontal bar chart where the center line on the x axis is 100. If a value is over 100 the bar goes right, otherwise it goes left (See below)horzontal bar chart.png 

From what I've found reading other threads I didn't find a solution: it seems in Power BI there's no equivalent option to that "vertical axis crosses" you see in excel. I've tried a workaround using the tornado visual but it doesn't suit my needs, since the bars diverge differently.

 

Does anybody have any idea on how to solve this? 

Thanks,

Gianluca 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Gianlucariotti ,

 

You can do this by making some measures and tweaking the chart in order to have the correct values.

 

Create the following measures:

 

Values below 100 = 
IF(SUM('Table (2)'[VAlue]) <= 100 , SUM('Table (2)'[VAlue]))

Until 100 values = IF(SUM('Table (2)'[VAlue])<= 100, 100-SUM('Table (2)'[VAlue]))

100 values = IF(SUM('Table (2)'[VAlue])> 100, 100)

values above 100 = if(SUM('Table (2)'[VAlue]) > 100 , SUM('Table (2)'[VAlue]) -100 )



Label over 100 = if(SUM('Table (2)'[VAlue]) > 100, SUM('Table (2)'[VAlue]))

 

 

Now create a stacked bar chart and place the measures in the following order:

Values below 100

Until 100 values

100 Values

values above 100

label over 100

 

Now on the setup of your chart do the following:

Colors of the measure below should be white (or equal to background)

values below 100

100 values

label over 100

 

data labels for all of the measure below should be turn off:

until 100 values

values above 100

100 values

 

Labels for the measure below should be place on specified location:

values below 100 - inside end

Label over 100 - inside start

 

Set the x-axis maximum value to 100

 

You should also do a custom tooltip instead of the normal one.

 

Result below and in attach file.

MFelix_0-1624614983795.png

 


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 @Gianlucariotti ,

 

You can do this by making some measures and tweaking the chart in order to have the correct values.

 

Create the following measures:

 

Values below 100 = 
IF(SUM('Table (2)'[VAlue]) <= 100 , SUM('Table (2)'[VAlue]))

Until 100 values = IF(SUM('Table (2)'[VAlue])<= 100, 100-SUM('Table (2)'[VAlue]))

100 values = IF(SUM('Table (2)'[VAlue])> 100, 100)

values above 100 = if(SUM('Table (2)'[VAlue]) > 100 , SUM('Table (2)'[VAlue]) -100 )



Label over 100 = if(SUM('Table (2)'[VAlue]) > 100, SUM('Table (2)'[VAlue]))

 

 

Now create a stacked bar chart and place the measures in the following order:

Values below 100

Until 100 values

100 Values

values above 100

label over 100

 

Now on the setup of your chart do the following:

Colors of the measure below should be white (or equal to background)

values below 100

100 values

label over 100

 

data labels for all of the measure below should be turn off:

until 100 values

values above 100

100 values

 

Labels for the measure below should be place on specified location:

values below 100 - inside end

Label over 100 - inside start

 

Set the x-axis maximum value to 100

 

You should also do a custom tooltip instead of the normal one.

 

Result below and in attach file.

MFelix_0-1624614983795.png

 


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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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