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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors
Top Kudoed Authors