I'm trying to calculate daily quantities based on a range of dates (start date and end date). I'll try and explain a little better through a simple example:
The 'Qty' should be spread across all the days in the range meaning 2 (10/2) is counted for 5 days for the first record and 3 is counted for 2 days from the second record. This boils down to the two records above producing the following output (to chart)
Qty for that day
(I hope I've worked this out right!)
I'm resigned to the fact the answer will probably involve aggr functions of some kind but thinking about them too much just makes me aggry!
I don't understand very much the "2 counted for 5 days" part, but using intervalmatch will do. Check the code and comments in this post to see if that helps. Although the fields are differents, but I think it may help you.
The "2 counted for 5 days" just means spreading the Qty of 10 across the range of 5 days. 10 divided by 5 equals 2.
I've had a look at that example you linked and some others. They look applicable but they look like they go the wrong way around. By that I mean they look like they're looking for a range a given date is in where I'm looking to take a range and expand it into given days.