1. Calculation functions
  2. All Functions
  3. Time and Date Functions
  4. LEAD

LEAD returns a value from a period in the future. 

You could use LEAD to calculate how this month's earnings compare to next year's projected monthly earnings. 

Syntax

LEAD(Value to offset, Offset amount, Substitute value [, Non-positive behavior])

Arguments

ArgumentData TypeDescription
Value to offsetNumber, Boolean, date,
time period, list, or text
The value to replace with a value from a different time period.
Offset amountNumber

Number of periods forward from which to retrieve a value.

Positive values refer to future periods, negative to past periods, and zero to the current period.

Substitute valueSame as Value to offset

Value to return if the Offset amount specifies a period outside of the model's time range.

Also used for non-positive offsets if you use the SEMISTRICT or STRICT keywords for the Non-positive behavior argument.

Non-positive behavior (optional) Keyword

Determines how the LEAD function uses the Substitute value argument.

The keywords are NONSTRICT, SEMISTRICT, and STRICT. There's more information in the Non-poisitive behavior keywords section below.

The LEAD function returns a result of the same data type as the Value to offset argument.

Non-positive behavior keywords

KeywordDescription
NONSTRICT

The default keyword if you omit the Non-positive behavior argument.

Returns the Value to offset if the Offset amount is positive, negative, or zero.

SEMISTRICTReturns the Value to offset if the Offset amount is positive or zero. 
STRICTReturns the Value to offset if the Offset amount is positive. In STRICT mode, LEAD applies to the future, and not to current periods. The fill value is returned if either shift < 0 or the future period is beyond model time range.

Syntax example

LEAD(Value to offset, 2, 0)

In this example, the LEAD 1 line item returns the value from two periods after each cell. If two periods after a cell is outside of the module’s time range, the formula returns the Substitute value of 0, as seen in the June column. The function does not contain the Non-positive behavior argument, so the default behavior is NONSTRICT.


JanFebMarchAprilMayJune
Value to
offset

  1

   2

   3

   4

   5

   6
LEAD 1  3   4   5   6   0   0

Additional information

If the period LEAD specifies is outside of the module's timescale, LEAD returns the value of the Substitute value argument.

Constraints

You can only use a line item for the Offset amount argument if the Value to offset and Substitute value arguments have the number data type. If they use the Boolean, date, time period, list, or text data type, you must enter a number directly into the Offset amount argument.

Calculation engine functionality differences

In Polaris, you can use numeric expressions for the Offset amount argument when you use a data type other than number for the Value to offset argument. Any number used for the Offset amount argument is rounded to the nearest integer.

In the Classic Engine, if you use a data type other than number for the Value to offset argument, you can only use numbers for the Offset amount argument, not numeric expressions or the results of line items. Any number used for the Offset amount argument is rounded towards zero.

Similar functions

Examples

Example 1

 LEAD(Value to offset, 2, Substitute value)

In this example, the LEAD 2 line item returns line item from two periods after each cell. If two periods after a cell is outside of the module’s time range, the formula returns the Substitute value. The formula returns the values of 500 and 600 contained in the May and June columns for the Substitute value. The function does not contain the Non-positive behavior argument, so the default behavior is NONSTRICT.


JanFebMarchAprilMayJune
Value to
offset

 1

  2

   3

  4

   5

  6
Substitute
value
100 200  300 400  500 600
LEAD 2  3   4   5   6  500 600

Example 2

 LEAD(Value to offset, Offset amount, Substitute value, [non-positive behavior])
In this example, the LEAD 3 line item returns the Substitute value for the period the Offset amount specifies. If the Substitute value specifies a period outside of the module's time range, the formula returns the Substitute value. This means the formula returns the value of 600 contained in the June column for the Substitute value. The function does not contain the Non-positive behavior argument, so the default behavior is NONSTRICT.


JanFebMarchAprilMayJune
Value to
offset

 1

  2

  3

  4

  5

  6
Offset
amount
 0 -1  0  1  0  1
Substitute
value
100200 300 400500 600
LEAD 3  1   1   3   5   5 600

Example 3

 LEAD(Value to offset, Offset amount, Substitute value, [, Non-positive behavior])

In this example, you can see how the different keywords for the Non-positive behavior change the results.


JanFebMarchAprilMayJune
Value to
offset

 1

  2

  3

  4

  5

  6
Offset
amount
 0 -1  0  1  0  1
Substitute
value
100200 300 400500 600
LEAD
SEMISTRICT

1

200

   3

  5

 5

600
LEAD
STRICT

100

200

 300

  5

500

600
LEAD
NONSTRICT
  1   1   3   5   5 600