Aggregate events with start and end date

I wonder if you might be able to do this through a scripted aggregation, similar to the example in this old post.