## Rolling Sum based on Target days/weeks

Super Contributor

## Rolling Sum based on Target days/weeks

Hi,

I may be overlooking the obvious, but in the sanpshot below the blue figure is the sum of Demand for 3 weeks (21 days indicated by the Target Stock days) Is there a way i can formulate this? So it Totals the demand based on the number of days in Target (i understand that i may have to use integer(21/7) instead of days...) as ANAPLAN isnt in days.

1 ACCEPTED SOLUTION

Accepted Solutions
Super Contributor

Well, a good sleep and a focused mind

`MOVINGSUM(Demand, 0, ROUND(Target Stock Days / 7 * 1, 0, DOWN) - 1) + OFFSET(Demand, ROUND(Target Stock Days / 7 * 1, 0, DOWN), 0) * (Target Stock Days / 7 * 1 - ROUND(Target Stock Days / 7 * 1, 0, DOWN))`

This formula calculates 'demand' across the 'target stock days' value precisely.

Maybe i will sleep before posting next question, but thought i would share a useful formula.

`MOVINGSUM(Demand, 0, ROUND(Target Stock Days / 7 * 1, 0, DOWN) - 1) + OFFSET(Demand, ROUND(Target Stock Days / 7 * 1, 0, DOWN), 0) * (Target Stock Days / 7 * 1 - ROUND(Target Stock Days / 7 * 1, 0, DOWN))`