Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Power BI matrix Column Total is correct but row total is wrong

Hi -

I have one measure called XYZ

which is directly coming from the ABC table by measure XYZ= SUMX('ABC'[XYZ])
XYZ ( I am getting correct results for this measure) Note there are some blanks

nameJanFebMarrow Total
a10  10
b5  5
Column Total15  15


I have a second measure called RTY

which is directly coming from the DEF table by measure RTY = SUMX('DEF'[RTY])

This is correct too

nameJanFebMarrow Total
Column Total20302070


I am trying to calculate FINAL = If ( XYZ = 0, RTY, XYZ)


The final measure solution should be:

nameJanFebMarrow Total
a1010105 (i am getting this incorrect)
b5201030(i am getting this incorrect)
Column Total15302040((i am getting this incorrect)


Community Champion
Community Champion

Hey @hitesh1607 ,


SUMX is an iterative function. If you just want the sum of a specific column just use the SUM function.

Try the following:

Sum XYZ = SUM( 'ABC'[XYZ] )
Sum RTY = SUM( 'DEF'[RTY] )


As another measure you can do your IF clause:

FINAL = IF ( [Sum XYZ] = 0, [Sum RTY], [Sum XYZ] )


If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
Best regards

If I use the above code even then I am getting the wrong row subtotal. (Column subtotal is working fine in the matrix visual)

Hi @hitesh1607 ,


Please try:

XYZ_ = SUM( 'ABC'[XYZ] )

RTY_ = SUM( 'DEF'[RTY] )

VAR C_ = IF([XYZ_]=0,[RTY_],[XYZ_])

If the problem persists,could you share the sample pbix with dummy data? 

Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


Helpful resources

PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Top Solution Authors
Top Kudoed Authors