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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Matrix conditional formating based on measure

Good day,

 

I would like to define a background color of matrix entry based on measure. Inside measure I plan to compare 3 entries of that matrix like A, B and C. If they equal - change a color. BUT I can't see related items inside, like in the format like Database[Field], only other measures instead.

 

How should I act? Thank you in forward.

5 REPLIES 5
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Is this problem sloved?
 
If it is sloved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
 
If not, please let me know.
 
Best Regards
Icey
Anonymous
Not applicable

Looking in to it 🙂 Will get back to you as soon as I'm done. Very grateful.

It seems that I need to compare current value with another one in the matrix. How this could be achieved in DAX calculated column context?

Icey
Community Support
Community Support

Hi @Anonymous ,

Is the result you want like the screenshot below?

difference.PNG

If so, you can create your column and measures like so:

column:

Index =
IF (
    'Table (2)'[Product] = "P1",
    1,
    IF ( 'Table (2)'[Product] = "P2", 2, IF ( 'Table (2)'[Product] = "P3", 3, 4 ) )
)

measure:

Measure =
VAR PreIndex =
    MAX ( 'Table (2)'[Index] ) - 1
VAR NextIndex =
    MAX ( 'Table (2)'[Index] ) + 1
VAR PreSales =
    CALCULATE (
        SUM ( 'Table (2)'[Sales] ),
        FILTER (
            ALLEXCEPT ( 'Table (2)', 'Table (2)'[Country] ),
            'Table (2)'[Index] = PreIndex
        )
    )
VAR NextSales =
    CALCULATE (
        SUM ( 'Table (2)'[Sales] ),
        FILTER (
            ALLEXCEPT ( 'Table (2)', 'Table (2)'[Country] ),
            'Table (2)'[Index] = NextIndex
        )
    )
VAR Condion1 =
    IF (
        MAX ( 'Table (2)'[Sales] ) = PreSales
            && MAX ( 'Table (2)'[Sales] ) = NextSales,
        1,
        0
    )
RETURN
    Condion1
Measure 2 =
IF (
    SUMX ( ALLEXCEPT ( 'Table (2)', 'Table (2)'[Country] ), [Measure] ) <> 0,
    1,
    0
)

This is my PBIX file.

 

Best Regards,
Icey

 

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

mauriciosotero
Resolver III
Resolver III

Hi good day for u 2,

 

Can you post an example?

Anonymous
Not applicable

Here comes the example.

https://1drv.ms/u/s!Aj8B8cjnRANvwKF10wTGv_0yYTd6Ww?e=1Affrl

 

In it I would like to decide about color based on Measure (which is now equal to 0) if 22-41, 32-41 and 42-41 are equal.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.