[]
        
(Showing Draft Content)

NTHVALUE

This function returns the value for the n-th row within the window frame. If there is no such row, the return value is null. It does not require ORDERBY.

Syntax

NTHVALUE(value_function, n)

Arguments

The function provides the following arguments.

Argument

Description

value_function

[required] The field name or formula.

n

[required] The nth row within the window frame.

The n should be a positive integer value.

Example

// WINDOW(NTHVALUE([@sold], 2), PARTITIONBY([city]),ORDERBY([month]))

city  |  month  |  sold  |   nth_value
----------------------------------------------
Paris      1       500       null
Paris      2       300       300
Paris      3       400       300
Rome       2       200       null
Rome       3       300       300
Rome       4       500       300