The MOVINGSUM formula returns the sum of a measure over a specified date range.
MOVINGSUM(measure, startDate, endDate)
measure– The measure to sum. Required.
startDate – Start date of the range. Required.
endDate- End date of the range. Required.
Returns the sum of the measure over the specified date range.
MOVINGSUM([Profit], CURRENT_PERIOD, SHIFT(CURRENT_PERIOD, "2M"))
//Calculates the sum of the profit for a particular month and 2 months after it
MOVINGSUM([Sales], DATE(2024,4,1), DATE(2024,8,31))
//Calculates the rolling sum between April and August 2024
We've used MOVINGSUM to calculate the rolling sum of the profit measure for each month and 2 months after that month. For example, the MOVINGSUM for January would be the sum of the profits for January, February, and March.
.png)
MOVINGSUM example
You can also use MOVINGSUM with forecasts to aggregate your measures over open and closed periods. In this example, we've aggregated the forecast measure for the open periods.
.png)