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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
BIanon
Helper V
Helper V

SUMX faster than SUM?

Hello Community,

I was trying to performance tune my model a bit and came across a situation that I do not understand and cannot explain.


I have a single Fact table, let's call it Table1. I am currently interating over the table using SUMX() while multiplying two values, in my mind, if I multiplied them in Power Query and just used a SUM() on the output column, that should be faster - but apparantly it is twice as slow which I cannot wrap my head around.

Measure one using SUMX:

SUMX('Table1', 'Table1'[Value] * 'Table1'[Multiplier])

Dax Studios timing:
Cold, average 22,4
Warm, average 1,4

Measure using SUM:

SUM( 'Table1'[MultipliedValue] )

Cold, average 51,6
Warm, average 3 

Can someone please explain to me how iterating over a table and multiplying to value + summing can be faster than just summing?

6 REPLIES 6
SridharP
New Member

When its comes to using the Iterators in measure , Iterators are faster than standard aggregators. Aggregators just syntex sugar coated  version of iterators.
The difference of syntex might make you look it like a slower version.

You could also refer it in the Definitive guide to DAX Book by Mark Russo and  Albert Ferrari

We can find a different opinion in using the iterators in column calculations.

Greg_Deckler
Super User
Super User

@BIanon I couldn't quite replicate this performance difference. Are you just using Card visuals or is there something else in your visuals that you are grouping on? It's a common misperception that X aggregators are slow but I have never found that to be the actual case when performance testing. X aggregators are actually very performant.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Thank you for your response.

I just tried with test data, only like 1k rows, and am not able to replicate the issue with test data either 😞

I connect to the PBIX via DAX Studios and just do an

EVALUATE
{ [Measure] }

I must have ****ed up something in my model since I am seeing this happen.


@BIanon That's exactly how I tried to replicate it using data generated from mockaroo.com and using Card visuals. Typically I would expect that SUM and SUMX would return essentially similar performance results, within a few dozen milliseconds of one another and it might vary as to which is faster between runs. This is exactly the results I received in my testing. I was using the Performance Analyzer pane.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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