HOW TO: Identify Specific Rows

HOW TO: Identify Specific Rows

SOURCEROWNUMBER

The sourcerownumber() function contains the row number in the original, source dataset. Using the sourcerownumber() function allows you to make transformations to specific rows in a dataset. You can use this function to promote any row to the header and delete rows or a range of rows. You can use the sourcerownumber() function in conditional statements, and can create a column index.

ROWNUMBER

The rownumber() function contains a row number index based on an order by parameter used in a Set, Derive, Window Transform. The rownumber() function is different from sourcerownumber() in that rownumber() is based on a ordering criteria built into a recipe step, where sourcerownumber() is based on the original dataset before recipe steps were applied. Rownumber() can be useful to rank data or index based on a calculation. Note: sourcerownumber() can be affected by certain restructuring steps, like Aggregates, unpivots, pivots, flattens, unnests, joins, lookups and unions

Example 1: Using sourcerownumber() to delete rows

Example 2: Using sourcerownumber() to index your dataset

Example 3: Using sourcerownumber() in a conditional function

Example 4: Using rownumber() to rank a column