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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
tsdick
Resolver I
Resolver I

PBI Table Column Total Incorrect

Hello Fellow Community Members, The following DAX expression is producing the correct row value, but the column total does not foot.  All other rows and columns in the matrix visual are correct.  Any suggestions?

 

Vol Qty Var = (
('Total Sales Grouped X'[Mix Vol PP]*'Total Sales Grouped X'[CP Sales Units])
-sumx('Total Sales Grouped X','Total Sales Grouped X'[Total units PP])
)
*sumx('Total Sales Grouped X','Total Sales Grouped X'[Price PP])
 
tsdick_0-1633532886546.png

 

2 ACCEPTED SOLUTIONS

Hello JD, thanks for the suggestion -- I understand your point on a single use of SUMX.  Your DAX suggestion throws off the row totals in the Vol Qty Var fix column.  I am wondering if using a combination of columns (built using CALCULATE) and measures (built using SUMX) from the made table is tripping up the DAX calc's.  

 

My DAX... (green expressions are columns and purple expressions are measures)

Vol Qty Var = if(sumx('Total Sales Grouped X','Total Sales Grouped X'[Total units PP])=0,

'Total Sales Grouped X'[Qty Var $'s],

(('Total Sales Grouped X'[Mix Vol PP]*'Total Sales Grouped X'[CP Sales Units])

-sumx('Total Sales Grouped X',[Total units PP]))

*sumx('Total Sales Grouped X','Total Sales Grouped X'[Price PP]))

 

Your Suggested Fix...

Vol Qty Var fix = SUMX ( 'Total Sales Grouped X', ( 'Total Sales Grouped X'[Mix Vol PP] * 'Total Sales Grouped X'[CP Sales Units] ) - ( 'Total Sales Grouped X'[Total units PP] * 'Total Sales Grouped X'[Price PP] ) )

 

The circled results in the screen print are incorrect.

tsdick_0-1633536503572.png

Thanks again for the assist.

 

TSDICK

View solution in original post

jdbuchanan71
Super User
Super User

@tsdick 

Your measure in your original post did not have all of the lines from your measure in your second post.  Also, you should never include a table name when referencing a measure.  It makes it much harder to understand what is going on in your code.  So updating the measure from your second post we get this.

Vol Qty Var =
SUMX (
    'Total Sales Grouped X',
    IF (
        'Total Sales Grouped X'[Total units PP] = 0,
        [Qty Var $'s],
        [Mix Vol PP] * [CP Sales Units] - 'Total Sales Grouped X'[Total units PP] * 'Total Sales Grouped X'[Price PP]
    )
)

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

@tsdick 

Your measure in your original post did not have all of the lines from your measure in your second post.  Also, you should never include a table name when referencing a measure.  It makes it much harder to understand what is going on in your code.  So updating the measure from your second post we get this.

Vol Qty Var =
SUMX (
    'Total Sales Grouped X',
    IF (
        'Total Sales Grouped X'[Total units PP] = 0,
        [Qty Var $'s],
        [Mix Vol PP] * [CP Sales Units] - 'Total Sales Grouped X'[Total units PP] * 'Total Sales Grouped X'[Price PP]
    )
)
jdbuchanan71
Super User
Super User

@tsdick 

In your measures, if you use SUMX more than once, chances are you're doing something wrong.  SUMX is an iterator where you give it the table you want go through row by row then you give it the calculation you want it to do on every row.  For your calculation, you want to look at every row in the 'Total Sales Grouped X' table and do a calculation on it so that would be like this.

 

Vol Qty Var =
SUMX (
    'Total Sales Grouped X',
    ( 'Total Sales Grouped X'[Mix Vol PP] * 'Total Sales Grouped X'[CP Sales Units] ) - 
	( 'Total Sales Grouped X'[Total units PP] * 'Total Sales Grouped X'[Price PP] )
)

note* you don't need the ( ) around the first and second parts of your calculation, I just think it makes it easier to read.

 

jdbuchanan71_0-1633534082148.png

Once it is done going through every row and doing the calculation it gives you the aggregation type you used.
SUMx, MINx, MAXx, AVERAGEx, etx.

 

Hello JD, thanks for the suggestion -- I understand your point on a single use of SUMX.  Your DAX suggestion throws off the row totals in the Vol Qty Var fix column.  I am wondering if using a combination of columns (built using CALCULATE) and measures (built using SUMX) from the made table is tripping up the DAX calc's.  

 

My DAX... (green expressions are columns and purple expressions are measures)

Vol Qty Var = if(sumx('Total Sales Grouped X','Total Sales Grouped X'[Total units PP])=0,

'Total Sales Grouped X'[Qty Var $'s],

(('Total Sales Grouped X'[Mix Vol PP]*'Total Sales Grouped X'[CP Sales Units])

-sumx('Total Sales Grouped X',[Total units PP]))

*sumx('Total Sales Grouped X','Total Sales Grouped X'[Price PP]))

 

Your Suggested Fix...

Vol Qty Var fix = SUMX ( 'Total Sales Grouped X', ( 'Total Sales Grouped X'[Mix Vol PP] * 'Total Sales Grouped X'[CP Sales Units] ) - ( 'Total Sales Grouped X'[Total units PP] * 'Total Sales Grouped X'[Price PP] ) )

 

The circled results in the screen print are incorrect.

tsdick_0-1633536503572.png

Thanks again for the assist.

 

TSDICK

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.