Forum Discussion

NelsonPay's avatar
NelsonPay
Frequent Visitor
11 months ago
Solved

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('T...
  • v-ssriganesh's avatar
    11 months ago

    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 )
    
    )

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

     
    Best regards,
    Ganesh Singamshetty.