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. |
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.
-
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)
- 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
- 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.
- 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: