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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
NelsonPay
Frequent Visitor

Force Matrix Table Subtotal at level 1

Hello I want to force the subtotal for a Matrix table with two levels In level 1 the subtotal is 0 but in level 2 there are positive values. This is the original formula: 

VAR total_positives=SUM('Total Sells'[Oversell >125%])
RETURN IF(total_positives>0,total_positives,0)

Level 1 is Product and Level 2 is Country for Product the subtotal is 0 but when you expand you find that in Country there is positive results. Also the idea of the formula is to make a normal sum but filter the result if it is a positive result show me that value if it negative show me 0. What can I do to make that the values appearing in country appears in the subtotal of product. 

6 REPLIES 6
Kedar_Pande
Super User
Super User

@NelsonPay 

Corrected Measure =
VAR TotalPositives = SUM('Total Sells'[Oversell >125%])
VAR IsSubtotal = ISINSCOPE('Table'[Country]) && NOT(ISINSCOPE('Table'[Product]))
RETURN
IF(
IsSubtotal,
TotalPositives,
IF(TotalPositives > 0, TotalPositives, 0)
)

 

If this answer helped, please click Kudos or mark as Solution.
-Kedar
LinkedIn: https://www.linkedin.com/in/kedar-pande

v-ssriganesh
Community Support
Community Support

Hello @NelsonPay

Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.

 

Thank you for being part of the Microsoft Fabric Community.

v-ssriganesh
Community Support
Community Support

Hello @NelsonPay,

We hope you're doing well. Could you please confirm whether your issue has been resolved or if you're still facing challenges? Your update will be valuable to the community and may assist others with similar concerns.

Thank you.

v-ssriganesh
Community Support
Community Support

Hello @NelsonPay,

Hope everything’s going great with you. Just checking in has the issue been resolved or are you still running into problems? Sharing an update can really help others facing the same thing.

Thank you.

 

v-ssriganesh
Community Support
Community Support

Hi @NelsonPay,
Thank you for reaching out to the Microsoft fabric community forum.

I’ve reproduced your scenario in Power BI Desktop using sample data with Product → Country hierarchy and the Oversell >125% column. Initially, I observed the same issue you described. the Product-level subtotal was showing 0 even though some Countries had positive values.

To resolve this, you need to adjust the DAX measure so that the “positive check” happens at the Country level, and then these results roll up correctly to the Product subtotal.

Here’s the corrected measure:

Total Positives =

SUMX (

    VALUES ( 'Total Sells'[Country] ),

    VAR total_positives =

        CALCULATE ( SUM ( 'Total Sells'[Oversell >125%] ) )

    RETURN IF ( total_positives > 0, total_positives, 0 )

)

vssriganesh_0-1759233129904.png

For your reference, I’ve attached a sample .pbix file.

 
Best regards,
Ganesh Singamshetty.

lbendlin
Super User
Super User

Note that you posted this in the Power Query section - better suited for a DAX related section.

 

Use the ISINSCOPE function to sense where in the matrix you are and return BLANK() for all levels where you don't want to see totals.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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