# How do I calculate a rolling sum?

There are two main possibilities to calculate a rolling sum:

### 1. The Aggregate analysis:

Set the "Period" to the desired rolling length, and to not forget to tick the setting “Rolling”.

### 2. Formula:

You can also use the formula

sum(series, window)

Example:

sum(usflof8344, YearsLength(2))
• This will calculate a 2-years rolling sum on “usflof8344”.