Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r0811

D toc

Excerpt

Generates a new column containing the row number as sorted by the order parameter and optionally grouped by the group parameter.

Tip

Tip: To generate row identifiers by the original order in the source data, use the $sourcerownumber reference. See Source Metadata References.

This function works with the following transforms:

D s lang vs sql
 

D s
snippetBasic

Example:

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextwindow rownumber() order:Date

rownumber()

Output: Returns the row number of each row.

Example with grouping:

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextwindow rownumber() order:Date group:QTR

rownumber() order:Date group:QTR

Output: Returns the row number of each row as ordered by the values in the Date column grouped by the QTR values. For each quarter value, the row number counter resets.       

D s
snippetSyntax

D lang syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextwindow value:rownumber() order: order_col [group: group_col]

rownumber() order: order_col [group: group_col]

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

D s lang notes

D s
snippetExamples

Example - Rolling window functions

Include Page
EXAMPLE - Rolling Functions
EXAMPLE - Rolling Functions

D s also
labelwindow