Creating unique Row IDs in Tableau Prep

Creating unique Row IDs in Tableau Prep is not something that is available out of the box, but you can  use below workaround for the same effect. This is an extension to the ranking trick in Tableau Prep. Lets see how we can get unique row ids for below data.

Original Data

Before going ahead, we need to make sure that there is a field that uniquely identifies each row. In our case, we can use the Name field, but if you have duplicate names, you can still get a unique field by creating a calculated field. This won’t work if you have duplicate rows and you need to perform deduping first in that case.

Sort Key with Calculation – STR(Score)+Name

Now create a self inner join with criteria [Sort Key] < = Sort Key.  Please note that you need a dummy step to join the data to itself.

Self Join

Create an aggregation with following setting

Aggregation

Rename the aggregated field and add an output step, you are done.

Final Flow and Data

 

You may also like...

2 Responses

  1. August 28, 2019

    […] our case we need to create row Ids per employee. Please see this post about creating row Ids if you are having difficulty in generating row Ids per […]

  2. September 30, 2019

    […] solution could be to join the data to itself to generate a row ID, like in this blog, and then remove the first row, however, this is a fairly tedious process for something that should […]

Leave a Reply

Your email address will not be published.