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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
thampton
Helper III
Helper III

Dynamic running total

I would like to create a running total based on different parameters (YTD, Last year (starting at 1/1-12/31),Trailing 12 mo,etc).

 

I have a table that has Date in column 1, total in column 2. 

 

I have the DAX below caculating a running total, how would i configure it to match the parameters above? 

 

Running total =
CALCULATE (
       SUM ( Total Column ),
       ALL (Table Name),
       Date Column<= EARLIER (Date Column)
)
1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

currently you have to create a measure for each "time calculation". A good starting point is to create a separate Calendar table and to read through these examples: https://www.daxpatterns.com/time-patterns/

 

In the future this will become much simpler, as you can read here:

https://blogs.msdn.microsoft.com/analysisservices/2019/03/01/whats-new-for-sql-server-2019-analysis-...

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

currently you have to create a measure for each "time calculation". A good starting point is to create a separate Calendar table and to read through these examples: https://www.daxpatterns.com/time-patterns/

 

In the future this will become much simpler, as you can read here:

https://blogs.msdn.microsoft.com/analysisservices/2019/03/01/whats-new-for-sql-server-2019-analysis-...

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
PattemManohar
Community Champion
Community Champion

@thampton  Based on the information that you have provided, please try this..

 

RunningTotal = CALCULATE(SUM(TotalColumn),
			 FILTER(ALL(TableName),DateColumn <= EARLIER(DateColumn))
			)

It will be always helpful if you can post some sample data and expected output.





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Kudoed Authors