The PREVIOUS function evaluates an expression based on the previous period of the Time dimension.
For example, you can use this function to compare the values of each period relative to the previous period.
Syntax
PREVIOUS(Expression)
Arguments
Argument | Data type | Description |
Expression | Number, Boolean, date, time period, list, or text | The expression to return the value from the previous period for. |
The PREVIOUS function returns a result of the same data type as the Expression argument (unless the expression resolves to a different data type).
Calculation engine functionality differences
In Polaris, you cannot use PREVIOUS in formulas of line items with a formula summary method. In the Classic Engine, you can.
In the Classic Engine:
- You can use the PREVIOUS function only with a time dimension. In Polaris, you can use PREVIOUS with any dimension.
- If the Expression argument has a data type of list or time period, and does not resolve to a different data type, the result line item must have the same data type.
Syntax Example
PREVIOUS(Revenue)
This formula returns the value from the previous period for each value of the Revenue line item.
Additional information
Values outside of the line item time range
If the PREVIOUS function returns a value from outside of a line item’s time range, it uses a default value. If the line item has a data type of:
- number, PREVIOUS returns a value of 0.
- Boolean, PREVIOUS returns a value of FALSE.
- text, date, or time period, PREVIOUS returns a value of BLANK.
Brought-Forward values
When you apply Brought-Forward to a line item, the PREVIOUS function includes it as an additional period before the first time period in a module. However, as there is no value before the Brought-Forward period itself, the PREVIOUS function returns the default value for the Brought-Forward period.
Constraints
The result line item you use the PREVIOUS function in must have Time as a dimension.
Examples
Month on month profit change
Jan 21 | Feb 21 | Mar 21 | Apr 21 | |
Net Profit | 215,770 | 221,123 | 223,495 | 220,129 |
Month on month profit change
| 215,770 | 5,353 | 2,372 | -3,366 |
In this example, an income statement module has line items on rows and time on columns. The Net Profit line item shows the net profit for a business.
The formula in the Month on month profit change line item uses the PREVIOUS function to retrieve the value of Net Profit from the previous period. The Net Profit for the previous period is subtracted from the Net Profit for the current period to calculate the change in profit from one month to another. As the module's time range starts in 2021, the value for Month on month profit change in Jan 21 is the same as the Net Profit.