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
Anonymous
Not applicable

My measure is not changing the background based on the condition.

Hi All,

I have created a measure

 image.png

This is my measure for color scale.

image.png

I am using conditional formatting for background colour but its not changing,.image.png

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

c1.png

 

You may create a measure like below.

 

Result = 
var _status = 
MAXX(
    'Table',
    'Table'[Status]
)
return
SWITCH(
    _status,
    "Completed a","#0000FF",
    "Not Completed b","#008000",
    "Completed c","#FFFF00",
    "Not Completed d","#FF0000",
    "Completed e","#DCDCDC",
    "Not Completed f","#778899"
)

 

 

Then you need to set the color format for the card visual as below.

c2.png

 

Result:

c3.png

 

c4.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

c1.png

 

You may create a measure like below.

 

Result = 
var _status = 
MAXX(
    'Table',
    'Table'[Status]
)
return
SWITCH(
    _status,
    "Completed a","#0000FF",
    "Not Completed b","#008000",
    "Completed c","#FFFF00",
    "Not Completed d","#FF0000",
    "Completed e","#DCDCDC",
    "Not Completed f","#778899"
)

 

 

Then you need to set the color format for the card visual as below.

c2.png

 

Result:

c3.png

 

c4.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , is it selectedvalue or the first measure which going to return complete?

 

Try the formula with the first measure.

if([Auto & ISO ..] = "Complete" ............... )

 

Also try to use Switch(True() ..

 

example

Switch(True(),

<Condition>, <result>,

<Condition>, <result>,

<Condition>, <result>,

/// Add more

,<Else result>

)

 

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
Anonymous
Not applicable

@amitchandak ,

Thanks for your rpl,

I have so many measures in similar way and the values inside the measre changes as the end user selects the Dates from the slicer.

It should look like this 

image.png

 

@Anonymous , the formula seems correct. Can you share sample pbix after removing sensitive data.

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
Anonymous
Not applicable

@amitchandak 

Please do let me know how to share the sample file .

 

@Anonymous , you can upload on google drive or one drive and share the link

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
Anonymous
Not applicable

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.