# Window Functions

Window functions perform operations across an entire table, table grouping (grouped rows), or defined window of rows.&#x20;

#### Cumulative window functions

Cumulative window functions evaluate a specified column in a table or grouping and return the running total or cumulative value for all rows up to and including the current row. This differs from aggregate values that calculate a summary value for the entire table or grouping.

|                                                                                                                                                             |                                                                                                                            |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| [cumulativeavg](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/cumulativeavg "mention")           | Calculates the running average up to and including the current row.                                                        |
| [cumulativecorr](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/cumulativecorr "mention")         | Calculates the correlation coefficient between dependent and independent data columns up to and including the current row. |
| [cumulativecount](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/cumulativecount "mention")       | Counts the number of non-null values up to and including the current row.                                                  |
| [cumedist](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/cumedist "mention")                     | Calculates the cumulative distribution of values relative to the current row value.                                        |
| [cumulativemax](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/cumulativemax "mention")           | Returns the largest value up to and including the current row.                                                             |
| [cumulativemin](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/cumulativemin "mention")           | Returns the smallest value up to and including the current row.                                                            |
| [cumulativestddev](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/cumulativestddev "mention")     | Calculates the standard deviation of values up to and including the current row.                                           |
| [cumulativesum](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/cumulativesum "mention")           | Calculates the sum of values up to and including the current row.                                                          |
| [cumulativevariance](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/cumulativevariance "mention") | Calculates the variance of a column up to and including the current row.                                                   |

#### Moving window functions

Moving window functions evaluate a specified column and return a value based on a defined window of rows that moves in relation to the current row.

|                                                                                                                                                     |                                                                                                                                                                                                           |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [movingavg](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/movingavg "mention")           | Calculates the numerical average of a column within a moving window.                                                                                                                                      |
| [movingcorr](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/movingcorr "mention")         | Counts the number of non-Null values in a moving window.                                                                                                                                                  |
| [movingcount](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/movingcount "mention")       | Calculates the correlation coefficient of two numerical columns within a moving window. See [Pearson (bivariate) correlation coefficient](https://en.wikipedia.org/wiki/Pearson_correlation_coefficient). |
| [movingmax](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/movingmax "mention")           | Finds the maximum value of a column within a moving window.                                                                                                                                               |
| [movingmin](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/movingmin "mention")           | Finds the minimum value of a column within a moving window.                                                                                                                                               |
| [movingstddev](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/movingstddev "mention")     | Calculates the standard deviation of a column within a moving window.                                                                                                                                     |
| [movingsum](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/movingsum "mention")           | Calculates the sum of a column in a moving window.                                                                                                                                                        |
| [movingvariance](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/movingvariance "mention") | Calculates the statistical variance of a column in a moving window.                                                                                                                                       |

#### Shifting window functions

Shifting window functions evaluate a specified column in a table or grouping and return the value from a row that shifts in relation to the current row.

|                                                                                                                                                 |                                                                                           |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| [filldown](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/filldown "mention")         | Replaces all `null` values in a column or grouping with the closest prior non-null value. |
| [first](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/first "mention")               | Returns the first row value of a column or grouping.                                      |
| [firstnonnull](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/firstnonnull "mention") | Returns the first non-null value from a column or grouping.                               |
| [lag](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/lag "mention")                   | Returns the value from a preceding offset row in a column or grouping.                    |
| [last](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/last "mention")                 | Returns the last row value in a column or grouping.                                       |
| [lastnonnull](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/lastnonnull "mention")   | Returns the last non-null value in a column or grouping.                                  |
| [lead](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/lead "mention")                 | Returns the value from a subsequent offset row in a column or grouping.                   |
| [nth](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/nth "mention")                   | Returns the value from the nth row of a column or grouping.                               |

#### Ranking window functions

Ranking window functions evaluate a specified column in a table or grouping and assign a rank to each row.

|                                                                                                                                                     |                                                                                                                         |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [ntile](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/ntile "mention")                   | Assigns the specified rank, in order, to the column rows of a column, approximately equal number of rows for each rank. |
| [rank](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/rank "mention")                     | Assigns ranks to unique values in a column, from rank 1 onwards. Skips duplicate values.                                |
| [rankdense](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/rankdense "mention")           | Assigns ranks to all values in a column, from rank 1 onwards. Assigns the same rank to duplicate values.                |
| [rankpercentile](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/rankpercentile "mention") | Ranks the rows in the table by percentile.                                                                              |
| [rownumber](https://support.meetuma.ai/uma-knowledgebase/data-and-reporting/analytics-pro/functions/window-functions/rownumber "mention")           | Numbers the table rows, starting with 1.                                                                                |
