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
rsbin
Super User
Super User

conditional format horizontal bar chart with one data point (no y-axis)

Good Afternoon,

I am using a horizontal bar chart visual with one data point that displays a Measure in Minutes.

rsbin_0-1614452071095.png

Hoping someone can advise how I can conditionally format the color of the bar.  Less than 30 = green, 30 - 45 = yellow, etc..

It seems I can only get the conditional format option when I enter a field into the y-axis.  But this measure does not have an applicable axis.  What am I missing?

 

Thanks and regards,

5 REPLIES 5
PaulDBrown
Community Champion
Community Champion

@rsbin 

Here is one (laborious...) way:

In the following example, I have set the low limit at 100 and the medium limit at 200:

For a simple sum, I created the following measures:

1) Low threshold:

 

 

Low = 
VAR  low = 100
RETURN
IF([Sum Value] > low, low, [Sum Value])

 

 

2) medium threshold

 

 

Medium = 
VAR Med = 200
RETURN
SWITCH(TRUE(),
[Sum Value] > [Low] && [Sum Value] < Med, [Sum Value] - [Low],
[Sum Value] >= Med, 100 )

 

 

3) High Threshold

 

 

High = 
IF([Sum Value] > 200, [Sum Value] -200)

 

 

The I add these three measures to a stacked bar chart, where you can set the colour for each measure, to get this

result.JPG

Add the measure as a tooltip:

Tooltip.png

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hello @PaulDBrown ,

Does sound like a very laborious way to accomplish this.  I will try to give it a shot to see if this will work for me and my user group.  Appreciate the detailed response.

Thanks kindly,

PaulDBrown
Community Champion
Community Champion

@rsbin 

 

Apologies..there is a mistake in the Medium threshold measure. It should be:

 

Medium = 
VAR Med = 200
RETURN
SWITCH(TRUE(),
[Sum Value] > [Low] && [Sum Value] < Med, [Sum Value] - [Low],
[Sum Value] >= Med, 100 )

 

 

 

(otherwise, since it is stacked, it adds 200 to the bar, when low + Med = 200)
I've corrected it in the original reply for the benefit of others.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






pranit828
Community Champion
Community Champion

Hi @rsbin 

You can use the Data Colors in the format tab to conditionally color.

pranit828_0-1614453296071.png

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

Hi @pranit828,  Appreciate the prompt response.

The fx is not available when I have only one data point.  This is what is causing me much grief!

rsbin_0-1614453489963.png

Is there a workaround to this?  Or am I totally missing something?

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.