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
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
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.