Skip to main content
Skip table of contents

MOVINGAVG

Category: Rollforward & time series

Overview

Description

Returns the moving average over the last WindowSize elements including the current one. If there are not enough elements with values, null is returned.

Use when you need a rolling average over a defined time window.

Syntax

MOVINGAVG('Node', "TimeLevel", WindowSize)

Parameters

  • Node: Input node, specified using the node name in single quotes (e.g. 'Profit')

  • TimeLevel: Name of the time level that forms the time series to average (e.g. "Month")

  • WindowSize: Number of elements (including the current one) to average (e.g. 3)


Examples

Two-period moving average by quarter

This example shows a two-period moving average across quarterly values. The result starts once enough values are available to fill the window.

Input node: Profit

Quarter

Profit

2025-Q1

30

2025-Q2

120

2025-Q3

210

2025-Q4

300

Formula: MOVINGAVG('Profit', "Quarter", 2)

Quarter

→ MOVINGAVG Result

2025-Q2

75 → (30+120)/2

2025-Q3

165 → (120+210)/2

2025-Q4

255 → (210+300)/2


Related Functions

Function

When to use instead

MOVINGSUM

When you need a rolling sum over the same time window instead of an average.

SHIFT

When you need to shift values along a time level rather than aggregate them over a rolling window.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.