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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Sumx totals wrong

Hi there I have a problem regarding the formula Sumx. Thing is that I need to use sumx because I want to multiply it with a realted table. So measure would be like Result = sumx(tablex, [measure] * RELATED(tableY;Column A)

 

The Measure part is what I have a question for. the attached Power pivot table shows the example. Measure 2 and 4 are identical but they come up with different numbers?

Why is this happening only when all columns are identical?

 

Table is this:

 

Table 1..pngTable 2.png

 

So table 13 sumx gives another result that sumx in table 1.

 

Please let me know why?

 

THanks

 

 

 

 

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

We think the step that caused the difference is that Table 13 has no column8.

 

Because SUM() is an aggregator function.  It adds up all the values in a single column you specify after applying all filters that will impact the formula. 

SUMX() is an iterator function.  It works through a table, row by row to complete the evaluation after applying all filters.

The Table13 doesn’t have a column to distinguish each row, so when we use the SUM function, it will calculate the total and put it in each row. Then we use the SUMX function, it will iterate each row and add total together.

 

SUMX 1.jpg

 

You also can refer to the following two great articles.

https://exceleratorbi.com.au/use-sum-vs-sumx/

https://radacad.com/sum-vs-sumx-what-is-the-difference-of-the-two-dax-functions-in-power-bi

 

If you have any question, please kindly ask here and we will try to resolve it.

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

View solution in original post

4 REPLIES 4
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

We think the step that caused the difference is that Table 13 has no column8.

 

Because SUM() is an aggregator function.  It adds up all the values in a single column you specify after applying all filters that will impact the formula. 

SUMX() is an iterator function.  It works through a table, row by row to complete the evaluation after applying all filters.

The Table13 doesn’t have a column to distinguish each row, so when we use the SUM function, it will calculate the total and put it in each row. Then we use the SUMX function, it will iterate each row and add total together.

 

SUMX 1.jpg

 

You also can refer to the following two great articles.

https://exceleratorbi.com.au/use-sum-vs-sumx/

https://radacad.com/sum-vs-sumx-what-is-the-difference-of-the-two-dax-functions-in-power-bi

 

If you have any question, please kindly ask here and we will try to resolve it.

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

amitchandak
Super User
Super User

@Anonymous , what is the definition of the Measure 

Anonymous
Not applicable

HI measure definition is: SUM(table1 or 13; column9)

Anonymous
Not applicable

Okay - thanks for the solution. This means I need to create a coloumn with a random value in each row to make sumx work. Great stuff. Have a nice day.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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