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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

How to change background color in matrix table based on values

Hello everyone, 

 

Haven't done anything similar before, I am currious if I am able to change background color based on value in matrix table. 
I have country column as you can see from image and two countries are columns values (spain and portugal) and some values about counties. 
I would like to have red color if the values are not matching and green if the values are matching. 
I have tried few things but the meausre I was creating wasn't good.

Capture.PNG

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You need to create a measure like , assume you have measure M1

 

color =

var _diff = if( calculate([M1] , Table[country] ="spain") = calculate([M1] , Table[country] ="Portugal") ,1,0)

return

if(_diff =1, "Green", "Red")

 

Use this in conditional formatting using filed value option

How to do conditional formatting by measure and apply it on pie? : https://youtu.be/RqBb5eBf_I4

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , You need to create a measure like , assume you have measure M1

 

color =

var _diff = if( calculate([M1] , Table[country] ="spain") = calculate([M1] , Table[country] ="Portugal") ,1,0)

return

if(_diff =1, "Green", "Red")

 

Use this in conditional formatting using filed value option

How to do conditional formatting by measure and apply it on pie? : https://youtu.be/RqBb5eBf_I4

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

This was very helpful, thanks a lot!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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