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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
VoltesDev
Helper V
Helper V

Matrix subtotal

Hi,

Just wondering if the current Power BI Matrix Subtotal have the ability to change Sum to Avg.

 

Also if I have 3 columns, then I turn on Row Subtotal, can we select to not calculate some of the column ?

This is related to that AVG, which if cannot calculate Avg instead total, it is better to don't show any value in that column, but still totalling other columns

 

Thanks,

 

2 ACCEPTED SOLUTIONS
GeraldGEmerick
Memorable Member
Memorable Member

@VoltesDev Matrix and table totals calculate the given measure in the context of ALLSELECTED essentially. They do not calculate a sum or an average per se. You need to build that into your measure. Often, using HASONEVALUE to determine if you are in a row or a total row, you then can use SUMX or AVERAGEX for the total.

View solution in original post

krishnakanth240
Continued Contributor
Continued Contributor

Hi @VoltesDev 

 

Use ISINSCOPE() to control subtotal logic

 

You can return
Normal value at row level
BLANK() at subtotal level (or custom logic)
Example
Measure=
IF(
ISINSCOPE(Dim[RowField]),
[Base Measure],
BLANK()
)

 

or

 

Custom Avg subtotal via DAX
If you want Avg at subtotal, Sum at rows
My Measure =
IF(
ISINSCOPE(Dim[RowField]),
[Value],
AVERAGEX(
VALUES(Dim[RowField]),
[Value]
)
)

This is average of visible rows, not raw data.

 

Please mark it as a solution with headup if this helps you. Thank You!

View solution in original post

4 REPLIES 4
krishnakanth240
Continued Contributor
Continued Contributor

Hi @VoltesDev 

 

Use ISINSCOPE() to control subtotal logic

 

You can return
Normal value at row level
BLANK() at subtotal level (or custom logic)
Example
Measure=
IF(
ISINSCOPE(Dim[RowField]),
[Base Measure],
BLANK()
)

 

or

 

Custom Avg subtotal via DAX
If you want Avg at subtotal, Sum at rows
My Measure =
IF(
ISINSCOPE(Dim[RowField]),
[Value],
AVERAGEX(
VALUES(Dim[RowField]),
[Value]
)
)

This is average of visible rows, not raw data.

 

Please mark it as a solution with headup if this helps you. Thank You!

Hi guys,

 

Thanks for the input.

The measures are good, hopefully that matrix or table visual have this setting in the future. Having measure sometime can break or need extra maintenance.

 

Thanks again.

MasonMA
Community Champion
Community Champion

Hi, 

 

Subtotals aggregate is using whatever your measure returns under that filter context. If your measure is SUM(), the subtotal will also be SUM.

However creating a measure that switches behavior at subtotal level, such as using ISINSCOPE() or HASONEVALUE() to detect whether you are at the row item or at a subtotal, can ideally return either the base value or an AVERAGEX() across visible rows.

GeraldGEmerick
Memorable Member
Memorable Member

@VoltesDev Matrix and table totals calculate the given measure in the context of ALLSELECTED essentially. They do not calculate a sum or an average per se. You need to build that into your measure. Often, using HASONEVALUE to determine if you are in a row or a total row, you then can use SUMX or AVERAGEX for the total.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.