[]
        
(Showing Draft Content)

Window Functions List

Window functions calculate their result based on a sliding window frame, a set of rows that are somehow related to the current row. It allows you to work with both aggregate and non-aggregate values all at once.

Aggregate Functions

Spread provides a number of aggregate functions. For more details, refer to the Formula Functions sections.

Note: The aggregate functions don’t require ORDERBY, but they accept the window frame definition.

Ranking Functions

Spread provides the following ranking functions, listed alphabetically.

Function

Description

CUMEDIST

This function returns the cumulative distribution value.

DENSERANK

This function returns the rank of the current row within its partition, without gaps.

ROWNUMBER

This function returns the number of the current row within the partition.

W_PERCENTRANK

This function returns the percentage of the rank value.

W_RANK

This function returns the rank of the current row within its partition with gaps.

Analytic Functions

Spread provides the following analytic functions, listed alphabetically.

Function

Description

FIRSTVALUE

This function returns the value of the argument from the first row of the window frame.

LAG

This function provides access to the value from a row at a given physical offset that leads the current row.

LASTVALUE

This function returns the value of the argument from the last row of the window frame.

LEAD

This function provides access to the value from a row at a given physical offset that follows the current row.

NTHVALUE

This function returns the value of the argument from the Nth row of the window frame.

NTILE

This function returns the bucket number of the current row within its partition.

Limitations

The costs of window functions will gradually increase due to computational complexity and data volume.