Skip to main content

I have a single that needs to essentially aggregate a rolling sum (of that last n months) of another metric. 

The manual method I have found is:

TargetMetric + TargetMetrictSELECT: Month -1] + TargetMetriceSELECT: Month -2]

(I am incuding the current month in the “last” three months calculation)

But if I want to change this to the last 5 months or the last 24 months, I would need to add an n number of selects.

How Can I formulaically drive this calculation?

Hi ​@LAS,

I think what you‘re looking for is MOVINGSUM.

MOVINGSUM(TargetMetric, 5)


As a follow up on that: in case you want your integer N to be formula driven, MOVINGSUM will not be the solution, as it doesn’t allow to come from a dimensioned metric.

In this case one solution could be to first cumulate the data and then calculate the difference between a month and N months before that one.

For example as seen in this screenshot:

The SET # of Rolling Months determines the # of rolling months for each version. The TargetMetric is where the data is in. TargetMetric Cumulate is a simple Cumulate formula. Finally, the TargetMetric Rolling consists of this formula:
'TargetMetric Cumulate'

- 'TargetMetric Cumulate'tBY CONSTANT: SHIFT(Month, -'SET # of rolling months')]


Reply