Extracts the value from a column that is a specified number of rows before the current value.

window value:PREV(myNumber, 1) order:Date

Output: Generates the new column, which contains the value in the row in the myNumber column immediately preceding the current row, when ordered by Date.

window value:PREV(col_ref, k_integer) order: order_col [group: group_col]

ArgumentRequired?Data TypeDescription
col_refYstringName of column whose values are applied to the function
k_integerYinteger (positive)Number of rows before the current one from which to extract the value

For more information on the order and group parameters, see Window Transform.

col_ref

Name of the column whose values are used to extract the value that is k-integer values before the current one.

Required?Data TypeExample Value
YesString (column reference)myColumn

k_integer

Integer representing the number of rows before the current one from which to extract the value.

 

Required?Data TypeExample Value
YesInteger4

Example - Examine prior order history