The PREVIOUS function evaluates an expression based on the preceding value across the selected dimension.
For example, you can use this function to compare the values of each period relative to the previous period.
Syntax
PREVIOUS(Expression [, 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. |
List (Polaris only) | List | The list over which the function should operate. The target line item must be dimensioned with any dimension compatible with this list. See Calculation engine functionality differences. |
The PREVIOUS function returns a result of the same data type as the Expression argument.
Calculation engine functionality differences
- In Polaris, you can't use PREVIOUS for line items that have the Formula summary method. In the Classic Engine, you can.
- In Polaris, you can use PREVIOUS with any dimension compatible with a dimension of the target, except Versions. For example you can use a list or its subset as the second argument when the target line item is dimensioned by a list. For versions, use PREVIOUSVERSION. In the Classic Engine, you can use PREVIOUS only with a time dimension.
- In Polaris, for time outside the time range hierarchy, PREVIOUS returns zero or blank values.
Syntax Example
PREVIOUS(Revenue)
This formula returns the preceding value of the Revenue line item.
PREVIOUS(Lead count, Sales stage order)
This formula looks up the lead count from the previous stage in the Sales stage order list.
Additional information
Values outside the line item time range
If the PREVIOUS function returns a value from outside 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
In Polaris, the target line item can be of any dimension compatible with the second argument List. In the Classic Engine, the target line item 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.
Lead drop between sales stages
1 | 2 | 3 | 4 | |
Lead count | 1,000 | 600 | 300 | 150 |
Previous stage lead count
| 0 | 1,000 | 600 | 300 |
Change
| 1,000 | -400 | -300 | -150 |
In this example, the function is dimensioned over the Sales stage order list, which is on columns.
The formula in the Previous stage lead count line item retrieves the lead count from the item immediately before the current one in the Sales stage order list. The formula in the Change line item calculates the difference in lead count between the current stage and the previous one. It shows how many leads were lost or gained as you move from one stage to the next in the pipeline.