OFFSET returns a value from a different time period, either before or after the current period. 

Use OFFSET to compare current sales with past sales. 

OFFSET(Value to offset, Offset amount, Substitute value)

ArgumentData typeDescription
Value to offsetNumber, Boolean, date,
time period, list, or text
Reference value from which you want to offset or retrieve data, for example, current sales.
Offset amountNumber

Number of periods to move from the current reference value:

  • Positive values move forward in time, to future periods.
  • Negative values move backward in time, to past periods.
  • Zero stays in the current period.
Substitute valueSame as Value to offset
Value to return if the Offset amount specifies a period outside or beyond the model's time range.

The OFFSET function returns a value of the same data type as the Value to offset argument.

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.

In Polaris, a value of NaN (Not a Number) for the Offset amount argument returns the Substitute value argument.

In the Classic Engine:

  • A value of NaN is equivalent to 0.
  • You can use the OFFSET function only with a time dimension. In Polaris, you can use OFFSET with any dimension except Versions.
  • 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.

OFFSET(Current sales, -1, 0)


JanFebMarAprMayJun
Current sales3,0004,0004,5003,7003,5004,100
Last month's sales03,0004,0004,5003,7003,500


The formula OFFSET(Current sales, -1, 0) is applied to the Last month's sales line item. In this formula:

  • Current sales is the reference value (Value to offset).
  • -1 is the number of periods to move from the current period (Offset amount). Negative 1 represents one month before the current period.
  • 0 is the value to substitute (Substitute value), when there's no data available at the specified period.

OFFSET is the same as LEAD in the NONSTRICT mode.

The Value to offset argument and result line item must share the same time range. Any formula that conflicts with this rule is rejected.


JanFebMarAprMayJun
FruitsApplePeachBananaPearFigMelon
VegCarrotTomatoCucumberOnionLettuceBroccoli
OFFSET(Fruits, -1, Veg)CarrotApplePeachBananaPearFig
OFFSET(Fruits, 2, Veg)BananaPearFigMelonLettuceBroccoli

FY16FY17FY18FY19FY20
Data
OFFSET(Data, 1, FALSE)