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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Hide certain parts of matrix

Good afternoon.

I have the following matrix

 

 

cquiros_3-1632775839331.png

 

 But , i want in the following form:

 

Type201920202021Chg ABSChg %
A-Revenue16,352,23319,912,52622,275,2532,362,72711.9%
B-Cost of Sales-697,902-931,800-1,637,882-706,08275.8%
C-GP15,654,33118,980,72620,637,3711,656,6458.7%
D-Does-12,123,759-14,666,690-15,194,498-527,8083.6%
E-OP3,530,5724,314,0365,442,8731,128,83726.2%

 

It's possible?

Also, I don't understand how to make the matrix calculate the Subtotal correctly. The Chg ABS=22,275,253-19,912,526 and
Chg %= 2,362,727/19,912,526

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

Hi  @Anonymous ,

Test the following measure:

 

Chg_ABS = 
CALCULATE (
    MAX ( 'Table'[value] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Type] = MAX ( 'Table'[Type] )
            && 'Table'[Year] = MAX ( 'Table'[Year] )
    )
)
    - CALCULATE (
        MAX ( 'Table'[value] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Type] = MAX ( 'Table'[Type] )
                && 'Table'[Year]
                    = MAX ( 'Table'[Year] ) - 1
        )
    )
Chg % = FORMAT(DIVIDE([Chg_ABS],CALCULATE(MAX('Table'[value]),FILTER(ALL('Table'),'Table'[Type]=MAX('Table'[Type])&&'Table'[Year]=MAX('Table'[Year])))),"0.001")*100&""&"%"

 

vluwangmsft_0-1632967402186.png

And if you want to show as your show ,test below:

Step1,create the following column:

Chg_ABS2 = IF('Table'[Year]=2021,
CALCULATE (
    MAX ( 'Table'[value] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Type] = EARLIER( 'Table'[Type] )
            && 'Table'[Year] = EARLIER ( 'Table'[Year] )
    )
)
    - CALCULATE (
        MAX ( 'Table'[value] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Type] = EARLIER ( 'Table'[Type] )
                && 'Table'[Year]
                    = EARLIER ( 'Table'[Year] ) - 1
        )
    ),BLANK())

 

Chg %2 = IF('Table'[Year]=2021,FORMAT(DIVIDE([Chg_ABS],CALCULATE(MAX('Table'[value]),FILTER(ALL('Table'),'Table'[Type]=EARLIER('Table'[Type])&&'Table'[Year]=EARLIER('Table'[Year])))),"0.001")*100&""&"%",BLANK())

 

Then create the following talbe:

Table3 = ADDCOLUMNS(SUMMARIZE('Table','Table'[Type],'Table'[Chg_ABS2]),"Year","Chg_ABS")
Table4 = ADDCOLUMNS(SUMMARIZE('Table','Table'[Type],'Table'[Chg %2]),"Year","Chg %")

merge table:

Table2 = UNION( SUMMARIZE('Table','Table'[Year],'Table'[Type],'Table'[value]), SELECTCOLUMNS(Table3,"Year",Table3[Year],"Type",Table3[Type],"value",Table3[Chg_ABS2]), SELECTCOLUMNS(Table4,"Year",Table4[Year],"Type",Table4[Type],"value",Table4[Chg %2]))

 

Create table base on the table2:

vluwangmsft_1-1632974164579.png

 

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

3 REPLIES 3
v-luwang-msft
Community Support
Community Support

Hi  @Anonymous ,

Test the following measure:

 

Chg_ABS = 
CALCULATE (
    MAX ( 'Table'[value] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Type] = MAX ( 'Table'[Type] )
            && 'Table'[Year] = MAX ( 'Table'[Year] )
    )
)
    - CALCULATE (
        MAX ( 'Table'[value] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Type] = MAX ( 'Table'[Type] )
                && 'Table'[Year]
                    = MAX ( 'Table'[Year] ) - 1
        )
    )
Chg % = FORMAT(DIVIDE([Chg_ABS],CALCULATE(MAX('Table'[value]),FILTER(ALL('Table'),'Table'[Type]=MAX('Table'[Type])&&'Table'[Year]=MAX('Table'[Year])))),"0.001")*100&""&"%"

 

vluwangmsft_0-1632967402186.png

And if you want to show as your show ,test below:

Step1,create the following column:

Chg_ABS2 = IF('Table'[Year]=2021,
CALCULATE (
    MAX ( 'Table'[value] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Type] = EARLIER( 'Table'[Type] )
            && 'Table'[Year] = EARLIER ( 'Table'[Year] )
    )
)
    - CALCULATE (
        MAX ( 'Table'[value] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Type] = EARLIER ( 'Table'[Type] )
                && 'Table'[Year]
                    = EARLIER ( 'Table'[Year] ) - 1
        )
    ),BLANK())

 

Chg %2 = IF('Table'[Year]=2021,FORMAT(DIVIDE([Chg_ABS],CALCULATE(MAX('Table'[value]),FILTER(ALL('Table'),'Table'[Type]=EARLIER('Table'[Type])&&'Table'[Year]=EARLIER('Table'[Year])))),"0.001")*100&""&"%",BLANK())

 

Then create the following talbe:

Table3 = ADDCOLUMNS(SUMMARIZE('Table','Table'[Type],'Table'[Chg_ABS2]),"Year","Chg_ABS")
Table4 = ADDCOLUMNS(SUMMARIZE('Table','Table'[Type],'Table'[Chg %2]),"Year","Chg %")

merge table:

Table2 = UNION( SUMMARIZE('Table','Table'[Year],'Table'[Type],'Table'[value]), SELECTCOLUMNS(Table3,"Year",Table3[Year],"Type",Table3[Type],"value",Table3[Chg_ABS2]), SELECTCOLUMNS(Table4,"Year",Table4[Year],"Type",Table4[Type],"value",Table4[Chg %2]))

 

Create table base on the table2:

vluwangmsft_1-1632974164579.png

 

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

Anonymous
Not applicable

Hi,  , thanks for your deeply appreciated help. It worked with some minor modifications.

Greg_Deckler
Community Champion
Community Champion

@Anonymous Yes it is possible: The New Hotness (Custom Matrix Hierarchy) - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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