Aggregate values for lists

I have a topic and within a topic there is a list of actions user did related to the topic (like a work actions journal). Work actions have dates and duration (among other info).

What i need to do is to show the list of work actions grouped by a year and for each year show an aggregate sum of all durations.

I cannot think of a good way to accomplish this. Especially not if i want to combine it with infinite scroll.

The only solutioni can think of is to have filter by year on top but i am looking if there are some other solutions i am missing.