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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
BeeFArmY
New Member

Conditional Formatting

I need some help.

I'm using the string below to return positive numbers as green and negative numbers as red. When using a slicer the string below works perfectly but when selecting the value on a bar chart it doesn't?

 

Variance Status Colour =
SWITCH(
    TRUE(),
    [Variance Budget vs Actual]>0, "#63BE7B",
    [Variance Budget vs Actual]<=0, "#F8696B")

 

 

Power Bi Issue Pic_1.jpgPower Bi Issue Pic_2.jpg

 

Thank you in advance.
3 REPLIES 3
Anonymous
Not applicable

Hi, @BeeFArmY 

Thanks for @bhanu_gautam reply. Have you solved the problem? Typically, setting the color format is just as @bhanu_gautam describes, can you share pbix files without sensitive data for testing purposes (sharing by OneDrive or GoogleDrive).

Best Regards,
Yang

Community Support Team

bhanu_gautam
Super User
Super User

@BeeFArmY ,Select your bar chart visualization.
In the Visualizations pane, click on the drop-down arrow next to the measure you want to format (e.g., [Variance Budget vs Actual]).
Select Conditional formatting and then Background color or Data colors (depending on your preference and the type of chart).
In the Conditional formatting window, choose Field value.
In the Based on field dropdown, select the measure you created (Variance Status Colour).




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






@bhanu_gautam thank you for responding so quickly.

 

I believe I'm already doing what has been suggested. The conditional formatting is working but only when using a slicer. When I'm selecting a value in Power Bi Issue Pic_3.jpganother visual which updates all of the other visuals, my conditional formatting doesn't work. For example, a minus should be red but shows as green.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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