1

I know how to do this with a data transformation. Now, suppose someone without a technical background needs to create a table with two columns: id --> unique_id vendor --> set of distinct values from a column that is included in the original dataset.

1st step : Remove all columns and keep only the Vendors column (done) 2nd step : Generate a list of distinct values. How can I do that? 3rd step : Add a unique id as a new column. Is that also possible?

I was able to perform the first action: Remove all columns, only keep the Vendors column. enter image description here

Sherar MDP
  • 241
  • 1
  • 5

1 Answers1

2

There are two problems here:

  1. Find unique values from a column
  2. Create and assign a new unique value column

Let's solve them one by one.

  1. There are multiple ways to achieve this in Contour. The one I would consider easiest for a less technical user is by using a pivot table. You can select the column you want to find unique values of (in your case vendor) in the Rows section of the pivot table configuration and select whatever you want in the Aggregates section (Row count works just fine).
    Make sure to switch to pivoted data and your vendor column will have each of the values exactly once.

  2. You already have unique ids from the previous step. You can use any injective function on values from the vendor column.
    If you want to have them completely unrelated to the original values you can use the Expression board, create a new column and use monotonically_increasing_id() function to create new unique values. Bear in mind that these values will change when you change the input (If VendorA was mapped to 1 it doesn't mean it will be mapped to 1 next time you build the dataset).