I think using the aggr() function is one possible approach.
But there is one pitfall in using the aggr() function. aggr() will sort its dimension values by load order. So if your Dates are not correctly ordered during load (chronologically), your results will be not correct.
To get around this, you can create a table with Date field with all values needed correctly sorted first in your script, then load your data, if you want, you can drop the first table then.
I remember I have posted solutions for some similar issues several times in the past, need to check.
edit: Here is a similar issue using aggr() function and the proposed solution using a sorted field first in the script.