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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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

 

 

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

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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