Skip to main content

Description

 

Returns the value of the previous cell of the current Metric in the iteration Dimension.

This function allows you to create single Metric iterative calculations.

For more information on how to create iterative calculations, see Iterative Calculations Within a Block Using PREVIOUS

 

Syntax

 

PREVIOUS(Iteration Dimension i, Offset])

 

Arguments 

 

Argument Type Dimensions Descriptions
Iteration Dimension
(required)
Number Any Dimension included in the Metric structure Dimension of the current Metric to which you want to apply an offset.
Offset
(optional)
Integer or Metric No Dimension or same as the Metric

Number of cells to offset.
If an integer is chosen, the default value is: 1
If a Metric is chosen, it can have the same Dimensions as the current Metric or fewer.

 

Returns

 

Type Dimensions
Same as the current Metric Same as the current Metric

 

Examples

 

Formula Description
PREVIOUS(Month) Returns the value of the previous month value of the current Metric.
PREVIOUS(Month,2) Returns the value of the current Metric cell, from two months previous.

 

Limitations

 

To avoid cell-level circular dependencies, Pigment restricts the use of the PREVIOUS function in some formula syntax.

 

  1. Combining Multiple Dimensions to Offset
    It is not possible to combine multiple PREVIOUS() functions using different Dimensions to offset in a given formula.
    For example, you can’t use this formula: PREVIOUS(Month) + PREVIOUS(Product)
     

  2. Advanced Function Compatibility

    The PREVIOUS function is incompatible with some of the other functions available in Pigment.
    These include:

  • IRR / XIRR/ NPV
  • DOUBLE_EXPONENTIAL_SMOOTHING / SIMPLE_EXPONENTIAL_SMOOTHING
  • FORECAST_LINEAR, FORECAST_ETS, SEASONAL_LINEAR_REGRESSION
  • DAYSINPERIOD, PRORATA, DAYSINPERIODWITHHOLIDAYS, PRORATAWITHHOLIDAYS
  1. Offset
    The offset parameter needs to be positive (negative offsets are ignored and considered blank). For example, PREVIOUS(Month, -1) would be ignored. Integer offsets tend to result in faster computation speeds than offsets through a Metric.
     
  2. Performance
    Datasets that include blanks allow for much faster computation. The PREVIOUS function can reduce the amount of blanks in your model and thus reduce performance.

For more context around limitations of using PREVIOUS(), see Iterative Calculations Within a Block Using PREVIOUS.

 

See Also

 

Excel: no equivalent 

Related articles: 

Be the first to reply!