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 [, List] [, List])
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).
This function allows for three arguments. If you have these functions with two arguments and don't declare a third one, this will default to Time. If you declare a third argument, then you can use any related dimension to the line item as an argument.
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.
- You can provide a third argument for the function, that specifies which dimension over which the function operates.
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.