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
Syndicate_Admin
Administrator
Administrator

Put subtotal column first matrix

good, I have this matrix and the subtotal column is the latter, I need it first

RomanG123_0-1681132473647.png

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

Hi, @Syndicate_Admin 

According to your description, you want to put the sub_total as first.

Total in the default Matrix is automatically generated and currently has no settings to place in the first column.

For your need , you can create a dimension column table in Power Query .

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1681264315270.png

We can create a "Blank Query" in Power Query and enter this M code to create a dimension column table:

let
    Source = {"Total"} &List.Distinct(Table[Column]),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Added Index" = Table.AddIndexColumn(#"Converted to Table", "Index", 1, 1, Int64.Type)
in
    #"Added Index"

vyueyunzhmsft_1-1681264356823.png

(2)Then we can load the data to Power BI Desktop , then we can create a measure :

Measure = var _cur_column =  MAX('Table 2'[Column1])
return
IF( _cur_column = "Total" , CALCULATE( SUM('Table'[Value]) ) ,
CALCULATE(SUM('Table'[Value]) , 'Table'[Column]  =_cur_column) )

(3)Then we can put the fields we need on the visual and we can sort the 'Table 2 '[Column1] by the 'Table 2'[Index] column and now we can meet your need:

vyueyunzhmsft_2-1681264436366.png

 

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

THANK YOU!!

v-yueyunzh-msft
Community Support
Community Support

Hi, @Syndicate_Admin 

According to your description, you want to put the sub_total as first.

Total in the default Matrix is automatically generated and currently has no settings to place in the first column.

For your need , you can create a dimension column table in Power Query .

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1681264315270.png

We can create a "Blank Query" in Power Query and enter this M code to create a dimension column table:

let
    Source = {"Total"} &List.Distinct(Table[Column]),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Added Index" = Table.AddIndexColumn(#"Converted to Table", "Index", 1, 1, Int64.Type)
in
    #"Added Index"

vyueyunzhmsft_1-1681264356823.png

(2)Then we can load the data to Power BI Desktop , then we can create a measure :

Measure = var _cur_column =  MAX('Table 2'[Column1])
return
IF( _cur_column = "Total" , CALCULATE( SUM('Table'[Value]) ) ,
CALCULATE(SUM('Table'[Value]) , 'Table'[Column]  =_cur_column) )

(3)Then we can put the fields we need on the visual and we can sort the 'Table 2 '[Column1] by the 'Table 2'[Index] column and now we can meet your need:

vyueyunzhmsft_2-1681264436366.png

 

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Syndicate_Admin
Administrator
Administrator

up

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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