I need… a row number

Intro

One quirk of Tableau Prep Builder is how when it inputs data, it doesn’t necessarily hold the same order as how the data appears to you in its original source. As Tableau Desktop, the typical place to use the output of the data, rarely makes use of the order of the rows in the data, this often doesn’t matter when the data is ready for analysis. However, when the data set does require some preparation, you may need to build some logic that references rows above or below the row you need to alter — thus making row order important.

With Tableau Prep Builder version 2023.1 and later, you can now add a Source Row Number field as the data is inputted into your preparation flow.

The Scenario

You need a data field numbering each row in turn.

The Steps

  1. Open Tableau Prep Builder and select Connect to Data. (n.b. at the time of writing only Microsoft Excel and Text File data types have the ability to add Source Row Numbers)

2. Select the file you want to prepare for analysis. Once it’s connected to Prep Builder, you’ll see an Input Step is automatically created. If you are using Excel and the workbook has many worksheets, you may find you need to drag in the worksheet(s) you wish to prepare.

You may notice Source Row Number is already present on the Input step but it is shown as being removed, signified by the struck-through text. This is due to Source Row Number being available to be used for each Excel and text file but is removed as standard as you may already have a field that gives the source data order in the form of a number or date field.

3. To bring the Source Row Number into your data set, you need to go to the Change Pane and delete the change that removes the introduction of the Source Row Number. As you hover over the Remove Field change, you will see an x appear in the top right corner of the change. Click on the x to remove the change — thus reintroducing the Source Row Number into the dataset.

Outcome

You will now have the Source Row Number field in your data set to use just as you would any other. You can use the field in filters, calculations or just leave it in for the final output.

Next
Next

I need… to add a date stamp to my filename