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
Ackbar-Learner
Resolver I
Resolver I

Matrix subtotal not working only for one category

Hi I have an issue with Matrix subtotal. So i have one measure where i calculate each line's value and a 2nd measure where i used a crossfilter to put a value to all lines. Then i created a third measure to merge both first and second measures in one column. See below:

 

Measure 1: BS02AsAtAllTransactionAmountDKK = CALCULATE(sum(GLTransClient[Amount]),DATESBETWEEN('Calendar'[Date],[BSFirstDate],[BSDateSelected]))

 

Measure 2: BS03NetProfit = CALCULATE(CALCULATE(sum(GLTransClient[Amount]),all(BSGLCoAHeaders[Count.Level0]),all('Calendar'[Date]),DATESBETWEEN('Calendar'[Date],[BSFirstDate],[BSDateSelected]),value(GLTransClient[Account])<5000000),CROSSFILTER(GLAccountClient[Account],GLChartOfAccounts[Account],None))

AckbarLearner_0-1665946256952.png

 

Measure 3: BS04AsAtAllTransactionAmountDKKwithResultsYTD =

 VAR result = [BS02AsAtAllTransactionAmountDKK]
 RETURN
    IF(SELECTEDVALUE(GLChartOfAccounts[L2]) = "Results year to date", value([BS03NetProfit]), result)

AckbarLearner_1-1665946437663.png

Up to now, all is working fine but when i collapse the CAPITAL AND RESERVES, the Results year to date is not being added to the subtotal.

AckbarLearner_2-1665946536424.png

All the other subtotals in the same column are working fine.

 

Grateful for any kind assistance.

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Ackbar-Learner 
Please try

BS04AsAtAllTransactionAmountDKKwithResultsYTD =
SUMX (
    SUMMARIZE ( GLChartOfAccounts, GLChartOfAccounts[L1], GLChartOfAccounts[L2] ),
    CALCULATE (
        VAR result = [BS02AsAtAllTransactionAmountDKK]
        RETURN
            IF (
                SELECTEDVALUE ( GLChartOfAccounts[L2] ) = "Results year to date",
                VALUE ( [BS03NetProfit] ),
                result
            )
    )
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @Ackbar-Learner 
Please try

BS04AsAtAllTransactionAmountDKKwithResultsYTD =
SUMX (
    SUMMARIZE ( GLChartOfAccounts, GLChartOfAccounts[L1], GLChartOfAccounts[L2] ),
    CALCULATE (
        VAR result = [BS02AsAtAllTransactionAmountDKK]
        RETURN
            IF (
                SELECTEDVALUE ( GLChartOfAccounts[L2] ) = "Results year to date",
                VALUE ( [BS03NetProfit] ),
                result
            )
    )
)

Perfect Mate! With this, I completed the Balance Sheet 😄 Thanks a lot.

Helpful resources

Announcements
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!

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.