Skip to content

First/Last

The First/Last component allows you to create groups of data and then return only the first or last rows from the group.

It does this by generating a SELECT statement with a window function in-line using the OVER keyword. Read the following documentation:

Snowflake Databricks Amazon Redshift
Snowflake Window functions Databricks Window functions Amazon Redshift Window functions
Snowflake First Value Databricks Window function First Value Amazon Redshift Window function First Value
Snowflake Last Value Databricks Window function Last Value Amazon Redshift Window function Last Value

Properties

Name = string

A human-readable name for the component.


Grouping Columns = dual listbox

Defines how the input data is grouped. This works like an SQL GROUP BY statement. The first or last element of each group will be selected.


Ordering within partitions = column editor

Input Column: The name of the column to use for sorting within the grouped data.

Ordering: The method of sorting on the chosen column. Options are Ascending, Descending, Nulls First, or Nulls Last.


First/Last Columns = column editor

  • Column: The name of the input column to be passed to the output.
  • First Last: Return the First or Last element of the chosen column in the grouped data.

Click the Add all button to automatically populate the Column list with all the columns which were not selected in the Grouping Columns property. First Last is set to First in each row. You can then selectively edit the list if required, but if you click Add all again it will return the list to the default fully populated state, removing any changes you have made.


Ignore Nulls = boolean

Select whether to ignore null values. The default setting is No (do not ignore null values).


Snowflake Databricks Amazon Redshift