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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Russ
Helper I
Helper I

Problematic running total measure by transaction ID - slow and inconsistent.

Have a Power Bi model with two tables - Ledger and Dates - linked by date field.

 

Ledger contains the following fields, with data for several years.

 

Russ_0-1598363756497.png

 

I would like to produce a matrix with the following fields:

Ledger [TransID]

Dates [Date]

[Total Amount] - Measure

[Runtotal Amount By TransID] - Measure

 

I have the following two measures:

 

Total Amount = 
    SUM ( Ledger[Amount] )


Runtotal Amount By TransID =
CALCULATE (
    [Total Amount],
    ALL ( Dates[Date] ),
    FILTER ( ALL ( Ledger[TransID] ), Ledger[TransID] <= MAX ( Ledger[TransID] ) )

 

I would like the Runtotal to be by TransID and not date. Also, to be calculated over all time, hence All (Dates[Date]. The matrix will also be sliced by date and/or account, but this should have no affect on the RunTotal measure. 

 

The Runtotal measure seems to work ok on its own and also in a matrix alongside  Ledger [TransID] and [Total Amount]. This takes just over a second to compute.

 

However, as soon as I add the Dates [Date] field to the matrix the compute time runs into minutes. 

 

I'm hoping there is a better way of achieving my desired output. I have messed around with Summarize and AddCoulmns, but to no avail.

 

Any ideas?

 

 

 

 

 

 

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

HI  @Russ 

You may try this formula as below:

Runtotal Amount By TransID = 
CALCULATE (
    [Total Amount],
    ALL ( Dates ),
    FILTER ( ALL ( Ledger[TransID] ), Ledger[TransID] <= MAX ( Ledger[TransID] ) ))

 

Use ALL ( Dates ) instead of ALL ( Dates[Date] )

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Community Champion
Community Champion

@Russ - Maybe try:

Runtotal Amount By TransID =
CALCULATE (
    [Total Amount],
    FILTER ( ALL ( Ledger[TransID] ), Ledger[TransID] <= MAX ( Ledger[TransID] ) )


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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  - thanks, but that does not fix it. Performance is exactly the same. Also, if you slice by date it makes the Runtotal incorrect.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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