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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.