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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
DPCCGF
Helper IV
Helper IV

Matrix Totals to the Front

Hi all, just like you can put a Row Total at the top of a Matrix, can you put Column Totals at the front of the matrix after the Row Headers?  TIA

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @DPCCGF 
We don't have this functionality as a format option, but there are some workarounds to achieve it.
Please refer to the linked video.

https://www.youtube.com/watch?v=VRUs0pWgsdE

 

If my answer was helpful please give me a Kudos and accept as a Solution.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi Ritaf1983 ,thanks for the quick reply, I'll add more.

Hi @DPCCGF ,

Regarding your question, are you planning to move the totals to this location?

vzhouwenmsft_0-1727834997915.png

Please follow these steps:

1.Use Power Query to duplicate your fact table, retaining only the fields used in 'Colums' in the matrix

vzhouwenmsft_4-1727836335226.png

vzhouwenmsft_5-1727836363811.png

 

vzhouwenmsft_6-1727836388214.png

vzhouwenmsft_0-1727836999595.png

Enter the following M code

 

let
    Source = Excel.Workbook(File.Contents("C:\Users\v-zhouwenbin\Desktop\(1)2024.10.2.xlsx"), null, true),
    Table_Sheet = Source{[Item="Table",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Table_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Type", type text}, {"Amount", Int64.Type}, {"Month", Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Type", "Amount"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Columns"),
    TotalRow = #table({"Month"}, {{"Total"}}),  //Replace 'Month' with your own column name.
    Combined = Table.Combine({TotalRow, #"Removed Duplicates"}),
    #"Added Index" = Table.AddIndexColumn(Combined, "Index", 1, 1, Int64.Type)
in
    #"Added Index"

 

vzhouwenmsft_1-1727837053562.png

2.Creating table-to-table relationship

vzhouwenmsft_2-1727837101758.png

3.Sort by column

vzhouwenmsft_3-1727837167513.png

4.Use the following DAX expression to create a measure

Measure = 
VAR _column = SELECTEDVALUE('Table(2)'[Month])
RETURN 
IF(_column = "Total",CALCULATE(SUM('Table'[Amount]),ALLEXCEPT('Table','Table'[Type])),SUM('Table'[Amount]))

5.Final output

vzhouwenmsft_4-1727837540476.png

 

Best Regards,
Wenbin Zhou

 

 

 

 

Ritaf1983
Super User
Super User

Hi @DPCCGF 
We don't have this functionality as a format option, but there are some workarounds to achieve it.
Please refer to the linked video.

https://www.youtube.com/watch?v=VRUs0pWgsdE

 

If my answer was helpful please give me a Kudos and accept as a Solution.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

RitaF983...........simple and easy.  Thank you!

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.