# Window Functions List

## Content

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](/spreadjs/docs/v17/formulareference/FormulaFunctions) 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](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/cumedist) | This function returns the cumulative distribution value. |
| [DENSERANK](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/denserank) | This function returns the rank of the current row within its partition, without gaps. |
| [ROWNUMBER](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/rownumber) | This function returns the number of the current row within the partition. |
| [W_PERCENTRANK](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/wpercentrank) | This function returns the percentage of the rank value. |
| [W_RANK](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/wrank) | 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](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/firstvalue) | This function returns the value of the argument from the first row of the window frame. |
| [LAG](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/lag) | This function provides access to the value from a row at a given physical offset that leads the current row. |
| [LASTVALUE](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/lastvalue) | This function returns the value of the argument from the last row of the window frame. |
| [LEAD](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/lead) | This function provides access to the value from a row at a given physical offset that follows the current row. |
| [NTHVALUE](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/nthvalue) | This function returns the value of the argument from the Nth row of the window frame. |
| [NTILE](/spreadjs/docs/v17/features/tablesheet/window-functions/window-functions-list/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.