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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

MAtrix conditional formatting

I have a matrix for 2019 that looks as follows

                     LC/HC

Region  

LA                 84

NA              100

WE                92

 

And a similar matrix for 2018:

 

                 LC/HC

Region  

LA                 82

NA              102

WE                90

 

Now 2018 value for LA was 82 whereas 2019 scorecard has 84. There has been an increase in Labor cost for 2019 and hence, I would like to show 84 with red background. Similarly if any other value in 2019 scorecard has a higher value that that present in 2018, it would be highlighted in red.

 

(LC/HC is a measure value)

 

Is there a way to write a measure for this comparison and perform a conditional formatting on the cell?

 

Thank you!

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

Hi @Anonymous ,

Does your data table look like this?

If not, if you have two tables for 2019 and 2018, you can append your tables in "Edit Query" .

oo8.PNG

I creatde a measure:

 

 

Measure 3 = 
VAR x =
CALCULATE(
    MAX(Sheet8[LC/HC]),
    ALLEXCEPT(
        Sheet8,
        Sheet8[Region]
    )
)
RETURN
IF(
    FIRSTNONBLANK(Sheet8[LC/HC], 1) = x,
    "RED", "WHITE"
)

 

 

Then add the measure to here:

oo9.PNGoo10.PNG

oo11.PNG

 

Best regards,
Lionel 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
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

Does your data table look like this?

If not, if you have two tables for 2019 and 2018, you can append your tables in "Edit Query" .

oo8.PNG

I creatde a measure:

 

 

Measure 3 = 
VAR x =
CALCULATE(
    MAX(Sheet8[LC/HC]),
    ALLEXCEPT(
        Sheet8,
        Sheet8[Region]
    )
)
RETURN
IF(
    FIRSTNONBLANK(Sheet8[LC/HC], 1) = x,
    "RED", "WHITE"
)

 

 

Then add the measure to here:

oo9.PNGoo10.PNG

oo11.PNG

 

Best regards,
Lionel Chen

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

Tad17
Solution Sage
Solution Sage

Without knowing how your data was set up I would suggest something like:

 

Check = If(lookupvalue('2018 table'[LC/HC],'2018 table'[Region],'2019 table'[Region])<lookupvalue('2019 table'[LC/HC],'2019 table'[Region],'2018 table'[Region]), 1, 2)

 

Then you include the result in the matrix

 

https://community.powerbi.com/t5/Desktop/Conditional-Formatting-based-on-other-measure-value/td-p/41...

 

Unfortunately, you do have to include the column for the "Check" number in the Matrix for the conditional formatting to work. Microsoft is apparently working on making this better.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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