Skip to main content
On this page

Kater SQL Functions Windows

Windows

A window works out a value for each row of the result from other rows of the result, such as a running total or a rank.

The Windows menu writes them. Write the OVER clause after the call. In a query, declare it with CUSTOM_CALCULATION. See Running totals, ranks and windows.

FunctionWhat it does
KATER__WINDOW_AGGREGATIONA running or trailing aggregate of the value, row by row in the OVER’s order.
KATER__LAGThe value from an earlier row, offset rows back in the OVER’s order.
KATER__LEADThe value from a later row, offset rows on in the OVER’s order.
KATER__FIRST_VALUEThe value on the first row of its partition, in the OVER’s order.
KATER__LAST_VALUEThe value on the last row of its partition, in the OVER’s order.
KATER__DELTAThe value minus the value on the row before.
KATER__PERCENT_DELTAThe change from the row before, as a share of that row’s value.
KATER__RANKThe value’s rank among the rows, with 1 for the largest or the smallest value.
KATER__ROW_NUMBERThe row’s place when the rows are sorted by the value, from 1.
KATER__SHARE_OF_TOTALThe value as a share of the total of all the rows in its partition.