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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.