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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
alexa_0028
Resolver II
Resolver II

Cumulative Sum Performance issue

Hi All,

I have a formula to calculate cumulative sum which gives the results but it has extremely slow performance :

Cumulative at country =
VAR AccountRev = FinalTraumaAllocation[Act22]
var table1 = SUMMARIZE(ALLSELECTED('Comp Org'[Comp. Org Country]),'Comp Org'[Comp. Org Country], "Sales22", FinalTraumaAllocation[Act22])
Return 
Sumx(FILTER(table1, [Sales22]>=AccountRev), [Sales22])

Can someone please help to optimise formula?
 
3 REPLIES 3
johnt75
Super User
Super User

It is not best practice to use SUMMARIZE to add calculated columns, see the article at https://www.sqlbi.com/articles/best-practices-using-summarize-and-addcolumns/ 

Try instead

Cumulative at country =
VAR AccountRev = FinalTraumaAllocation[Act22]
var table1 = ADDCOLUMNS(
    SUMMARIZE(ALLSELECTED('Comp Org'[Comp. Org Country]),'Comp Org'[Comp. Org Country]), 
    "Sales22", CALCULATE( FinalTraumaAllocation[Act22] )
)
Return 
Sumx(FILTER(table1, [Sales22]>=AccountRev), [Sales22])

Hi @johnt75 
Thank you for the suggestion. I have reformatted DASX.
However, I still have performance issues. It is loading visual in 1 minute.

If the cumulative totals don't need to take account of other filter settings, such as date range, then you could look into moving the calculations into Power Query or creating a summary calculated table in DAX. That way the performance hit would be a one-off during data load and the visuals should be instantaneous.

If you do need to interact with other slicers or filters I am afraid I cannot help further, optimization is not my strong suit.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.

Top Solution Authors
Top Kudoed Authors