Extracts the value from a column that is a specified number of rows before the current value. |
The row from which to extract a value is determined by the order in which the rows are organized at the time that the function is executed.
If you are working on a randomly generated sample of your dataset, the values that you see for this function might not correspond to the values that are generated on the full dataset during job execution.
group
and order
parameters to define the groups of records and the order of those records to which this function is applied. prev(myNumber, 1) order:Date |
Output: Returns the value in the row in the myNumber
column immediately preceding the current row, when ordered by Date
.
prev(col_ref, k_integer) order: order_col [group: group_col] |
Argument | Required? | Data Type | Description |
---|---|---|---|
col_ref | Y | string | Name of column whose values are applied to the function |
k_integer | Y | integer (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.
Name of the column whose values are used to extract the value that is k-integer
values before the current one.
Required? | Data Type | Example Value |
---|---|---|
Yes | String (column reference) | myColumn |
Integer representing the number of rows before the current one from which to extract the value.
k=1
represents the immediately preceding row value.group
parameter is applied, then this parameter should be no more than the maximum number of rows in the groups.
Required? | Data Type | Example Value |
---|---|---|
Yes | Integer | 4 |