Skip to main content
Skip table of contents

PREVIOUS

Category: Rollforward & time series

(warning) The previous function is almost never necessary and has considerable performance and usability disadvantages over the ROLLFORWARD function. Its usage is not advised, unless you absolutely must - contact the Valsight support for information on your specific problem to evaluate if it can be modelled with a ROLLFORWARD instead.

Overview

Description

Returns the previous period value of a node, except for the base period where it returns the value of the base node. All effects applied between the node and the base node therefore cumulate over the year. The function can be used to create models where the value of a node depends on the result for the previous period of a node higher in the value driver tree, thereby creating a loop that is resolved along the time dimension. An example is provided below, where the 'Base Cost' node depends on the final 'Cost' of the previous year, calculating the costs based on the costs of the previous year with the two drivers inflation and productivity.

Use when you need loop-style logic with a defined base case rather than a simple previous-period comparison.

Syntax

PREVIOUS('Node', "Level", 'BaseNode', "BaseValue")

Parameters

  • Node: Input node of which the previous period value is taken, for example 'Cost'.

  • Level: The time level that defines the previous value, for example "Year" where the previous of "2026" is "2025".

  • BaseNode: Input node that is used to get the value of the node for the base period, for example 'Initial Cost'.

  • BaseValue: The value describing the base period, for example "2025".

Limitations

When using the PREVIOUS function, the following limitations apply to all nodes between 'Node' and 'BaseNode':

  • No manipulation of time, for example by using SHIFT.

  • All nodes must have the time level used for the loop.

  • 'Node' and 'BaseNode' must have the same levels.

  • The loop cannot span multiple sub-models.


Examples

Loop Logic with an Explicit Base Period

This example shows how PREVIOUS creates a loop along the time dimension by taking the prior year's result and using a fixed base period to start the calculation.

Input node: 'Initial Cost'

Year

Cost

2025

100

Input node: 'Productivity Change'

Year

Productivity Change

2025

0%

2026

20%

2027

20%

2028

20%

Input node: 'Cost Inflation'

Year

Cost Inflation

2025

0%

2026

10%

2027

10%

2028

10%

Formula: PREVIOUS('Cost', "Year", 'Initial Cost', "2025")

Year

→ PREVIOUS Result

2025

100

2026

100

2027

130

2028

169

Formula: 'Base Cost' * (EXPAND(1, "Year") + 'Cost Inflation' + 'Productivity Change')

Year

Cost

2025

100

2026

130

2027

169

2028

219.7


Related Functions

Function

When to use instead

ROLLFORWARD

When the same logic should be modelled in a more modern and performant way instead of relying on PREVIOUS loop logic.

PY

When you only need a simple previous-year reference instead of loop-style logic with an explicit base case.

JavaScript errors detected

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

If this problem persists, please contact our support.