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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
HDD328
Frequent Visitor

Trying to format individual values in a matrix table

I've got a matrix table with actual values in it. I am trying to format each individual value based on targets from a seperate table. this is the mesure i've made to format this.

OilLightsFormatting = IF( SUM(LossByCodeActual[Values]) > SUM(LossByCodeTargets[Values]), "Red", "Green")

i've used similar in the past with no issues. this time though, it only makes the values in the matrix all the same color. this is a sample of what my tables look like. 

HDD328_0-1728670692595.png

I dont believe it's a relationship issue. both tables are formatted the same and have the same code column. many to many relationship. any ideas what i'm doing wrong or how to get this formatting to work? thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @HDD328 

 

For your question, here is the method I provided:

 

Here's some dummy data

 

“LossByCodeActual”

vnuocmsft_0-1728871844261.png

 

“LossByCodeTargets”

vnuocmsft_3-1728871926302.png

 

vnuocmsft_2-1728871882489.png

 

Create a measure.

 

OilLightsFormatting = 
var _code = SELECTEDVALUE('LossByCodeActual'[Loss By Code])
RETURN
IF(
    SUM('LossByCodeActual'[Values]) > 
    LOOKUPVALUE('LossByCodeTargets'[Values], 'LossByCodeTargets'[Loss By Code], _code), 
    "Red", 
    "Green"
)

 

Here is the result.

 

vnuocmsft_4-1728872006364.png

 

Regards,

Nono Chen

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

2 REPLIES 2
Anonymous
Not applicable

Hi @HDD328 

 

For your question, here is the method I provided:

 

Here's some dummy data

 

“LossByCodeActual”

vnuocmsft_0-1728871844261.png

 

“LossByCodeTargets”

vnuocmsft_3-1728871926302.png

 

vnuocmsft_2-1728871882489.png

 

Create a measure.

 

OilLightsFormatting = 
var _code = SELECTEDVALUE('LossByCodeActual'[Loss By Code])
RETURN
IF(
    SUM('LossByCodeActual'[Values]) > 
    LOOKUPVALUE('LossByCodeTargets'[Values], 'LossByCodeTargets'[Loss By Code], _code), 
    "Red", 
    "Green"
)

 

Here is the result.

 

vnuocmsft_4-1728872006364.png

 

Regards,

Nono Chen

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

elitesmitpatel
Super User
Super User

please share the dummy data and sample output images 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.