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
sthandiwe
Frequent Visitor

Background colour formatting.

Hi All

I have a dashboard where I need the background of a cell to reflect a certain colour depending on the contents of it. The rules are as follows.

sthandiwe_0-1602231447449.png

It works well mostly. But there are some times when it reflects the wrong colour as shown below, the top right "Not Approved" should be in red, not yellow:

sthandiwe_1-1602231584545.png

 

Note:

0=Not Approved=Red
1=Approved=Green

2=Rejected=Yellow

 

2 REPLIES 2
PaulDBrown
Community Champion
Community Champion

@sthandiwe 

Let's assume you are using a measure for the Approval Status. You can create a measure for the conditional formatting like:

Condit. format =
SWITCH(TRUE(),

[Approval Status] = "Not Approved", 0,

Approval Status] = "Approved", 1,

2)

Now use this measure in the conditional formatting interface -select the measure in the "based on the field" option- 





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.






amitchandak
Super User
Super User

@sthandiwe , need to check data for that. Can you share sample data and sample output in a table format? Or a sample pbix after removing sensitive data.

 

Can you create a color measure directly on values like in the given example and use that with the "Field Value" option(in place od rule

 

color =
switch ( true(),
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity1" && sum('Table'[Value]) >500,"lightgreen",
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity2" && sum('Table'[Value]) >1000,"lightgreen",
// Add more conditions
"red"
)

 

 

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.