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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
yaman123
Post Partisan
Post Partisan

Running Total Calculation

Hi all, 

 

I have seen online and theres many ways of calculating the running total or cumulative total. 

 

I have a column Collection Litres and a date column Sample Date. I woud like to calculate the running total YTD for collection litres. If i select sample date 01/02/2021 - 28/02/2021, the total should sum collection litres from March 2020 until Feb 2021. 

 

TIA

 

Yasir

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @yaman123 

If your column Collection Litres and column Sample Date are in the same table, you may take steps below for reference.

1. create measure total_YTD

-
total_YTD =
var mmax = maxx(ALLSELECTED(Table6),Table6[Sample Date])
var mmin = EDATE(mmax,-12)
return
calculate(sum('Table6'[Collection Litres]), FILTER(all('Table6'), 'Table6'[Sample Date] >mmin && 'Table6'[Sample Date] <=mmax))
-

v-xiaotang_2-1619002532711.png

-

it calculates the total_YTD between 2016/6/16  - 2017/6/30

v-xiaotang_3-1619002917379.png

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @yaman123 

If your column Collection Litres and column Sample Date are in the same table, you may take steps below for reference.

1. create measure total_YTD

-
total_YTD =
var mmax = maxx(ALLSELECTED(Table6),Table6[Sample Date])
var mmin = EDATE(mmax,-12)
return
calculate(sum('Table6'[Collection Litres]), FILTER(all('Table6'), 'Table6'[Sample Date] >mmin && 'Table6'[Sample Date] <=mmax))
-

v-xiaotang_2-1619002532711.png

-

it calculates the total_YTD between 2016/6/16  - 2017/6/30

v-xiaotang_3-1619002917379.png

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@yaman123 , Try a measure like

 

 

New measure =
var _max = maxx(allselected('Date', 'Date'[date])
var _min = eomonth(_max,-12)
return
calculate(sum(Table[Value]), filter(all('Date'), 'Date'[date] >=Min && 'Date'[date] <=_max))

 

 

or

 


New measure =
var _max = maxx(allselected('Date', 'Date'[date])
var _min = eomonth(_max,-12)
return
calculate(sum(Table[Value]), filter(all('Date'), 'Date'[date] >=Min && 'Date'[date] <=_max && Date[Date] <=max(Date[Date])))

 

 

If you need trend refer: https://www.youtube.com/watch?v=lOEW-YUrAbE

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.