Hi experts!
I need to do a calc in my PBCS application developing a business rule.
I have a dimension on columns called Days and I fill value of my account1 into Calc_Account during Nextdays (number of days is Account2).
For example:
For D1 I would need to copy value for account1 into calc_account from same day to next 3 (total 4), so in Calc_account should have:

For D2 in my example I need to copy value of Account1 into Calc_account (sameday) and next 2 (total 3) with sum other values if exists. Like:

In my example from D2 until D4 I'll have value=8 (because I had 5 from D1 to D4, and 3 of D2 to D4)

I think that I have to use a loop but I don't know how to implement
Could you help me about this?
Thanks!