cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver II
Resolver II

SUMX vs SUM gives different total - why and best practice

I have Raw data [Fiscal Qtr ending] & [Net Revenue]. I am trying to get PBI to return a {Total Net Revenue] "x numbers of days back". SO I use DAX ... Calculate(SUM, DATESINBETWEEN)

 

I started off using Calculate(SUMX , DATESINBETWEEN) - and I notice very small discrepancy (Refer image RED)

However, if I use Calculate(SUM, DATESINBETWEEN) it is correct.. 

 

I dont know if SUMX is the wrong DAX to use - clearly this is the case..

Can you help me understand why? PBI.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: SUMX vs SUM gives different total - why and best practice

I guess the difference is that with SUM, if you have 100 rows of data, it can do it in a single operation.

 

Whereas with SUMX there will be 100 separate calcuations which then result in a final amount which opens the door for rounding issues????


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Highlighted
Microsoft
Microsoft

Re: SUMX vs SUM gives different total - why and best practice

Hi @malcolmwun,

 

That is a very good question and lucky for you there is a very good answer here in this blog post by @MattAllington

 

http://exceleratorbi.com.au/sum-vs-sumx-in-dax/

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Highlighted
Resolver II
Resolver II

Re: SUMX vs SUM gives different total - why and best practice

Whilst the conclusion here is "Agregate a single column, use SUM".. do we know why in my examples SUMX returned a tiny discrepancy?

 

Thank you Phil

Highlighted
Microsoft
Microsoft

Re: SUMX vs SUM gives different total - why and best practice

I guess the difference is that with SUM, if you have 100 rows of data, it can do it in a single operation.

 

Whereas with SUMX there will be 100 separate calcuations which then result in a final amount which opens the door for rounding issues????


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

Helpful resources

Announcements
Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

June 2020 Community Highlights

June 2020 Community Highlights

Featured community members, changes to the Community, and more! Read up on recent Power BI community news.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Kudoed Authors