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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Running Total

Hello everyone

 

Below is the dataset that I have and i would like to calculte the running total. I have see older posts requesting similar calculation but I was not able to make it work. Is someone able to provide me with the dax function.

Thanks

 

 

fanisgeorg_0-1646423577633.png

 

1 ACCEPTED SOLUTION

@Anonymous I am thinking something like below. 'Dates'[Date] would reference your date or calendar table which I am assuming is what you are using for your axis.

Spent Running Total =
VAR __MonthSeq = MAX('Monthly By Project Size'[Month Seq])
RETURN
CALCULATE(SUM('Monthly By Project Size'[Total Spent in USD]),FILTER(ALL('Monthly By Project Size'),'Monthly By Project Size'[Month Seq] <= __MonthSeq) && 'Dates'[Date] < __MonthSeq)

 



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...

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.  Please also show the expected result there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Ashish_Mathur 

 

Thanks Ashish, unfortunately I can not share the file outside my organization

 

Tx

Fanis

Greg_Deckler
Community Champion
Community Champion

@Anonymous So that should be something along the lines of:

Spent Running Total Measure =
  VAR __MonthSeq = MAX('Table'[Month Seq]
RETURN
  SUMX(FILTER(ALL('Table'),[Month Seq] <= __MonthSeq),[Total Spent in USD])

or:
Spent Running Total Measure =
  VAR __MonthSeq = MAX('Table'[Month Seq]
RETURN
  CALCULATE(SUM([Total Spent in USD]),FILTER(ALL('Table'),[Month Seq] <= __MonthSeq))



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...
Anonymous
Not applicable

@Greg_Deckler 

 

Thanks Creg

In both formulas i am getting the error that the RETURN is incorrect

 

The syntax for 'RETURN' is incorrect. (DAX(VAR __MonthSeq = MAX('Monthly By Project Size'[Month Seq]RETURN SUMX(FILTER(ALL('Monthly By Project Size'),'Monthly By Project Size'[Month Seq] <= __MonthSeq) ,'Monthly By Project Size'[Spent

@Anonymous Missing paren:

Spent Running Total Measure =
  VAR __MonthSeq = MAX('Table'[Month Seq])
RETURN
  SUMX(FILTER(ALL('Table'),[Month Seq] <= __MonthSeq),[Total Spent in USD])

or:
Spent Running Total Measure =
  VAR __MonthSeq = MAX('Table'[Month Seq])
RETURN
  CALCULATE(SUM([Total Spent in USD]),FILTER(ALL('Table'),[Month Seq] <= __MonthSeq))


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...
Anonymous
Not applicable

@Greg_Deckler 

Brilliant thanks a lot,

One last touch if you dont mind please. Can we some how show nopthing for the future months? The first line chart i have used your dax in the second chart I have done the same in my excel source, can we make the chart using the dax look like the one from excel?

Spent Running Total =
VAR __MonthSeq = MAX('Monthly By Project Size'[Month Seq])
RETURN
CALCULATE(SUM('Monthly By Project Size'[Total Spent in USD]),FILTER(ALL('Monthly By Project Size'),'Monthly By Project Size'[Month Seq] <= __MonthSeq))

fanisgeorg_0-1646511950090.png

fanisgeorg_1-1646512205205.png

 

 

@Anonymous I am thinking something like below. 'Dates'[Date] would reference your date or calendar table which I am assuming is what you are using for your axis.

Spent Running Total =
VAR __MonthSeq = MAX('Monthly By Project Size'[Month Seq])
RETURN
CALCULATE(SUM('Monthly By Project Size'[Total Spent in USD]),FILTER(ALL('Monthly By Project Size'),'Monthly By Project Size'[Month Seq] <= __MonthSeq) && 'Dates'[Date] < __MonthSeq)

 



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...
Anonymous
Not applicable

@Greg_Deckler 

Thanks, i figfured it out. thanks a lot.

 

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
Top Kudoed Authors