[]
        
(Showing Draft Content)

LEAD

This function provides access to the value from a row at a given physical offset that follows the current row. If there is no such row, the default value is returned. It does not accept window frame definitions, such as FRAMEROWS and FRAMERANGE.

Syntax

LEAD(value_function, [offset_value], [default_value])

Arguments

The function provides the following arguments.

Argument

Description

value_function

[required] The field name or formula.

[offset_value]

[optional] Row offset after the current, offset = 1.

The offset should be a non-negative integer. If it is 0, the value_function is evaluated for the current row.

[default_value]

[optional] default value, default = null

Example

// WINDOW(LEAD([@city]), ORDERBY([sold]))

city     |    sold     |    lead
----------------------------------------------
Paris         100           Berlin
Berlin        150           Rome      
Rome          200           Moscow
Moscow        200           London
London        300           null

// WINDOW(LEAD([@city], 2), ORDERBY([sold]))

city     |    sold    |    lead
----------------------------------------------
Paris         100           Rome      
Berlin        150           Moscow
Rome          200           London
Moscow        200           null
London        300           null