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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
weezle80
Frequent Visitor

Conditional Formatting Based on Month-Over-Month Matrix Values

I am completely lost trying to figure out how to conditionally format my matrix columns so it calls out values that are less than the previous month. From my AgencyAssignment table, I have the Contract Name field under Rows, Month (Date Hierarchy) under Columns, and Sum of Agencies under Values. Contract A had 2 Agencies for Jan, Feb, Mar, & April, for a total of 8. However, Contract B dropped from 65 Agencies in January to 63 Agencies in February, so that 63 needs to be highlighted. Same for the drops for Contract D, and so on. I have been digging through forums and YouTube and have tried multiple things and nothing is working out right. Can you help?

 

weezle80_1-1681238207754.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @weezle80 ,

I have created a simple sample, please reer to my pbix file to see if it helps you.

Create 2 measures.

Measure =
VAR _1 =
    EDATE ( MAX ( 'Table'[DATE] ), -1 )
VAR _2 =
    CALCULATE (
        MAX ( 'Table'[value] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[DATE] = _1
                && 'Table'[contract name] = SELECTEDVALUE ( 'Table'[contract name] )
        )
    )
VAR _mindae =
    MINX ( ALL ( 'Table' ), 'Table'[DATE] )
RETURN
    IF ( MAX ( 'Table'[DATE] ) = _mindae, 0, MAX ( 'Table'[value] ) - _2 )
Measure 2 = IF([Measure]<0,"Red",BLANK())

 

vrongtiepmsft_0-1681354003306.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

1 REPLY 1
Anonymous
Not applicable

Hi @weezle80 ,

I have created a simple sample, please reer to my pbix file to see if it helps you.

Create 2 measures.

Measure =
VAR _1 =
    EDATE ( MAX ( 'Table'[DATE] ), -1 )
VAR _2 =
    CALCULATE (
        MAX ( 'Table'[value] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[DATE] = _1
                && 'Table'[contract name] = SELECTEDVALUE ( 'Table'[contract name] )
        )
    )
VAR _mindae =
    MINX ( ALL ( 'Table' ), 'Table'[DATE] )
RETURN
    IF ( MAX ( 'Table'[DATE] ) = _mindae, 0, MAX ( 'Table'[value] ) - _2 )
Measure 2 = IF([Measure]<0,"Red",BLANK())

 

vrongtiepmsft_0-1681354003306.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

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.

Top Solution Authors