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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Mike_Sims
Regular Visitor

Row Subtotal for Matrix

Hi.  I am trying to average each row of a matrix across the columns, in my case years, and was hoping to do so via a subtotal.  Each row is a quick measure.  The first row is an average by each year.  The second row is a sum by each year.  The third row is a division of the second row over the first row... pretty basic stuff.  For each of these rows i need the mean average to show as a subtotal (instead of the sum subtotal).  Currently the First row is giving the average subtotal (assuming this is because it is an average measure) however the bottom two rows are adding.  I can't see easily how to fix this.  Any help would be appreciated.

 

Need to change the subtotal to an averageNeed to change the subtotal to an average

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Mike_Sims , Not sure I got it. You can try measures like

 

Sum of avg headcount = Sumx(Values(Table[Year]), [Average headcount])

 

Avg of leavers = AverageX(Values(Table[Year]), [leavers])

 

or use isinscope to change measure

 

if(isinscope(Table[Year]), [Measure1], [Measure2])

 

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Anonymous
Not applicable

Hi @Mike_Sims,

Please take a look at the following blog to use Dax expression with if statement to check hierarchy levels to handle the total level calculations.

Clever Hierarchy Handling in DAX - SQLBI

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Mike_Sims,

Please take a look at the following blog to use Dax expression with if statement to check hierarchy levels to handle the total level calculations.

Clever Hierarchy Handling in DAX - SQLBI

Regards,

Xiaoxin Sheng

amitchandak
Super User
Super User

@Mike_Sims , Not sure I got it. You can try measures like

 

Sum of avg headcount = Sumx(Values(Table[Year]), [Average headcount])

 

Avg of leavers = AverageX(Values(Table[Year]), [leavers])

 

or use isinscope to change measure

 

if(isinscope(Table[Year]), [Measure1], [Measure2])

 

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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