Add row numbers
The Add row number step creates a new column adding sequential numbers to each row.
You can sort the numbers in ascending or descending order. You can add row numbers down the whole table, add numbers that repeat after a certain number of rows, repeat each number a set amount of times before advancing to the next number, and number based on another column. Numbering based on another column is a powerful way to add numbers to things like line items that share an order ID, or to rank your data.
Input/output
The input data we'll use with this step is a table of 15 rows with the 4 columns from a sales report.
The new output table has an additional column named 'Row Number'. The column starts with '1' in the first row, and increases by 1 with each row. The step will add a new column with sequential row numbers to any connected dataset.
Default settings
By default, the 'Column Name' will be set to 'Row Number', 'Start with' will be set to '1', and the rows will be numbered in ascending order.
Custom settings
To sort the numbers in descending order, click '+' to expand the 'Numbering Settings' section and change the default setting from 'the top' to 'the bottom'. The numbers will now be sorted from highest to lowest.
To see how many times a certain data type (like payment type) appears in your data set, you can change 'Number the entire table' to 'Number based on' value in a selected column. This will help you count repetitions of a value in your selected column.
There are also options to have this 'Row number' column repeat each successive value a certain number of times ('Repeat numbers') or restart from your initial value after a certain number of rows ('Restart after').
Helpful tips
- If two tables have the same number of rows but do not share a matching column, use this step and then the Combine tables step to create a new column that you can use to combine the tables.