Skip to content

Window Calculation

Window Calculation allows the user to set up a calculation using a window function. Window functions operate on a specific subset ("window") of a data set. For more information, read the following:


Properties

Name = string

A human-readable name for the component.


Include Input Columns = boolean

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


Partition Data = dual listbox

Select the columns that will define how the input data is partitioned. The window calculation will be performed on each partition.


Ordering Within Partitions = column editor

Select the columns that will be used to sort the partitioned data. For each column, select the sort order: Asc (sort ascending), Desc (sort descending), Nulls First (sort null values first), or Nulls Last (sort null values last). You can select multiple columns to create a complex sort. You can drag the selected columns to reorder the sort level if required.


Functions = column editor

Select a function to be performed on the rows contained in the window:

Refer to the list of supported functions below. Multiple functions can be selected. For each function, select the Input Column that the function will act on, and the Output Column that the result will be written to.

Supported Window functions:

  • Any Value: Snowflake only. Returns some value of the expression from the group. For full details, read the documentation for Snowflake.
  • Approximate Count Distinct: Snowflake only. Uses HyperLogLog to return an approximation of the distinct cardinality of the input. For full details, read the documentation for Snowflake.
  • Array Aggregate Distinct: Snowflake only. Returns the input values, pivoted into an array. For full details, read the documentation for Snowflake.
  • Average: Returns the average (arithmetic mean) of the input column values in the window. For full details, read the following documentation:
  • Bit AND Aggregate: Snowflake only. Returns the bitwise AND value of all non-Null numeric records in a group. For full details, read the documentation for Snowflake.
  • Bit OR Aggregate: Snowflake only. Snowflake only. Returns the bitwise OR value of all non-Null numeric records in a group. For full details, read the documentation for Snowflake.
  • Bit XOR Aggregate: Snowflake only. Returns the bitwise XOR value of all non-Null numeric records in a group. For full details, read the documentation for Snowflake.
  • Conditional Change Event: Snowflake only. Returns a window event number for each row where the value of an argument is different from the value of the argument in the previous row. For full details, read the documentation for Snowflake.
  • Conditional True Event: Snowflake only. Returns a window event number for each row within a window partition based on the result of a boolean argument. For full details, read the documentation for Snowflake.
  • Count: Returns a count of the non-Null values for the specified field. For full details, read the following documentation:
  • First Value: Given an ordered set of rows, returns the specified column value with respect to the first row in the window frame. For full details, read the following documentation:
  • Hash Aggregate: Snowflake only. Returns an aggregate signed 64-bit hash value over the (unordered) set of input rows. For full details, read the documentation for Snowflake.
  • Kurtosis: Snowflake only. Returns the population excess kurtosis of non-Null records. For full details, read the documentation for Snowflake.
  • Last Value: Given an ordered set of rows, returns the specified column value with respect to the first row in the window frame. For full details, read the following documentation:
  • List Aggregate Distinct: Snowflake and Redshift only. Returns the concatenated input values, separated by a delimiter string. For full details, read the following documentation:
  • Maximum: Returns the maximum of the input expression values. The MAX function works with numeric values and ignores Null values. For full details, read the following documentation:
  • Median: Snowflake and Redshift only. Calculate the median value for the range of values in a window or partition. Null values in the range are ignored. For full details, read the following documentation:
  • Minimum: Returns the minimum of the input expression values. The MIN function works with numeric values and ignores Null values. For full details, read the following documentation:
  • Population Variance: Returns the sample variance of a set of numeric columns. For full details, read the following documentation:
  • Sample Variance: Returns the sample variance of a set of numeric columns. For full details, read the following documentation:
  • Standard Deviation: Returns the standard deviation of a set of numeric values. For full details, read the following documentation:
  • Standard Deviation Population: Returns the population standard deviation of a set of numeric values. For full details, read the following documentation:
  • Sum: Returns the sum of the input column in the window. For full details, read the following documentation:

Lower Bound = drop-down

This property is visible after Ordering Within Partitions is set. Select which row of the partition the window calculation will start on. Options are:

  • unbounded preceding: The window starts at the first row of the partition.
  • current row: The window starts at the current row.
  • offset preceding: The window starts a number of rows (offset) before the current row. This requires you to set the Lower Bound Offset property.

Upper Bound = drop-down

This property is visible after Ordering Within Partitions is set. Select which row of the partition the window calculation will end on. Options are:

  • unbounded following: The window ends at the last row of the partition.
  • current row: The window ends at the current row.
  • offset following: The window ends a number of rows (offset) after the current row. This requires you to set the Upper Bound Offset property.

Lower Bound Offset = integer

If the Lower Bound property is set to offset preceding, enter the number of rows before the current row that the window will start on.


Upper Bound Offset = integer

If the Upper Bound property is set to offset following, enter the number of rows after the current row that the window will end on.


Snowflake Databricks Amazon Redshift (preview)