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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Firas_Belgouthi
Regular Visitor

Problem with Matrix total rows is not summing correctly

Hi,
I'm creating a balancesheet Matrix.
I have a fact table in which i have gl_account's transactions overtime 

OB =
CALCULATE(
        DIVIDE(SUM('FACT'[OB]), COUNT('FACT'[OB])),
        ALLEXCEPT('FACT', 'FACT'[GL_ACCOUNT_DESCRIPTION],'FACT'[ACCOUNTGROUP],'FACT'[Account_Type],'FACT'[PARTICULARS])
    )


CB =
VAR Total_T  = [FTM]    
VAR Average_OB = DIVIDE(SUM('FACT'[OB]), COUNT('FACT'[OB]))
Var r =
    Total_T +
    CALCULATE(
        Average_OB,
        ALLEXCEPT('FACT', 'FACT'[GL_ACCOUNT_DESCRIPTION],'FACT'[ACCOUNTGROUP],'FACT'[Account_Type],'FACT'[PARTICULARS])
    )
return r

[FTM] is the sum of trunsactions


Firas_Belgouthi_0-1718355538425.png

 

2 REPLIES 2
Anonymous
Not applicable

Hi @Firas_Belgouthi 

 

In matrix and table visuals, the total is calculated on the underlying data, not simply sum up the visible results in the visual. If you want to sum up the row results into Total row, you can follow a pattern introduced in the following links:

Solved: Need to summarize column with parameters - Microsoft Fabric Community

Obtaining accurate totals in DAX - SQLBI

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

amitchandak
Super User
Super User

@Firas_Belgouthi , You need to have measures like

 

CB =
SUMX(
Summarize('FACT', 'FACT'[GL_ACCOUNT_DESCRIPTION],'FACT'[ACCOUNTGROUP],'FACT'[Account_Type],'FACT'[PARTICULARS], DimDate[Year Month]),
VAR Total_T = [FTM]
VAR Average_OB = DIVIDE(SUM('FACT'[OB]), COUNT('FACT'[OB]))
RETURN
Total_T +
CALCULATE(
Average_OB,
ALLEXCEPT('FACT', 'FACT'[GL_ACCOUNT_DESCRIPTION], 'FACT'[ACCOUNTGROUP], 'FACT'[Account_Type], 'FACT'[PARTICULARS])
)
)

 

 

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors