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! Learn more

Reply
Theo1403
Advocate I
Advocate I

Apply conditional formatting on a matrix based on other value in the matrix

Hi all,

 

I created a matrix that shows the accounts receivable and accounts payable balances for several companies in a group. The values come from a transaction table that consists of all the accounts payable and accounts receivable transactions for all of the companies. The row and column values in the matrix come from different columns in that same transaction table. I want to apply conditional formatting to the matching (green) and not matching (red) values. Therefor I need a measure that sums the balance in the current cell and the balance in related cell (for example: company 2 has an A/P balance on company 1, which matches the A/R balance of company 2 on company 1). The end result should look like the picture attached. This shoud be possible, but I am completely stuck...

Theo1403_0-1721822546813.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Theo1403 

 

Here I create a set of sample for your reference:

vzhengdxumsft_0-1721873081339.png

Write a measure and drag it to a matrix:

_Sum = SUM('Table'[Value])

vzhengdxumsft_1-1721873157753.png

Then add a measure:

Color =
VAR _currentCompany1 =
    MAX ( 'Table'[Company1] )
VAR _currentCompany2 =
    MAX ( 'Table'[Company2] )
RETURN
    IF (
        [_Sum]
            + CALCULATE (
                [_Sum],
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    'Table'[Company1] = _currentCompany2
                        && 'Table'[Company2] = _currentCompany1
                )
            ) <> 0,
        "Red",
        "Green"
    )

 

Click the [_Sum] and select the Background color in the Conditional formatting:

vzhengdxumsft_2-1721873291746.png

Then select the Field value in Format style box and select the [color] in the what field should we base this on?

vzhengdxumsft_3-1721873395155.png

The result is as follow:

vzhengdxumsft_4-1721873539719.png

 

 

Best Regards

Zhengdong Xu
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 @Theo1403 

 

Here I create a set of sample for your reference:

vzhengdxumsft_0-1721873081339.png

Write a measure and drag it to a matrix:

_Sum = SUM('Table'[Value])

vzhengdxumsft_1-1721873157753.png

Then add a measure:

Color =
VAR _currentCompany1 =
    MAX ( 'Table'[Company1] )
VAR _currentCompany2 =
    MAX ( 'Table'[Company2] )
RETURN
    IF (
        [_Sum]
            + CALCULATE (
                [_Sum],
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    'Table'[Company1] = _currentCompany2
                        && 'Table'[Company2] = _currentCompany1
                )
            ) <> 0,
        "Red",
        "Green"
    )

 

Click the [_Sum] and select the Background color in the Conditional formatting:

vzhengdxumsft_2-1721873291746.png

Then select the Field value in Format style box and select the [color] in the what field should we base this on?

vzhengdxumsft_3-1721873395155.png

The result is as follow:

vzhengdxumsft_4-1721873539719.png

 

 

Best Regards

Zhengdong Xu
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