Skip to content

Lead-Lag

Allows the user to determine a value from a preceding or following row at a given offset within a group (or partition) of values.

Uses the following Window Functions:

For specific function documentation, read:

Data platform Lead function Lag function
Snowflake Lead Lag
Amazon Redshift Lead Lag

Properties

Name = string

A human-readable name for the component.


Include Input Columns = drop-down

Defines whether the component passes all input columns into the output. Default is Yes.


Partition Data = dual listbox

Defines how the input data is partitioned in order to perform the rank calculation. The calculation is then performed on each partition.


Ordering within partitions = column editor

  • Input Column: The input column name for sorting within the partitioned data. You can drag to reorder.
  • Ordering: The order of the sorting: Ascending (Asc) or Descending (Desc).

Functions = column editor

  • Window Function:
    • Lead: Returns the column from rows earlier in the partition.
    • Lag: Returns the column from rows later in the partition.
  • Input Column: The name of the input column that the lead/lag function will return.
  • Offset: The number of rows to go forward (lead) or backwards (lag) in the partition.
  • Output Column: The name of the output column that the window function will create.

Ignore Nulls = drop-down

Disregard Null values when determining which row to use. Null values do not count toward reaching the offset. The default is No.


Strategy

Generates a select statement with a window function in line using the OVER keyword. For more details read:


Snowflake Delta Lake on Databricks Amazon Redshift Google BigQuery Azure Synapse Analytics