Forum Discussion
kevbrown1980
4 hours agoFrequent Visitor
Create Distinct Index
Hi, Within my data I have a column called Consultant. I would like to anonymise that consultant so need to create a new index column starting at 1 but need it to only change number when the consulta...
benibix
Helper V
2 hours agoHi kevbrown1980
uzuntasgokberk's code does the job. If you'd rather stay in the ribbon, there's a second route. Duplicate the query, keep only the Consultant column and use Remove Duplicates. Then Add Column › Index Column › Custom, with starting index 1 and increment 1. You now have one row per consultant with a number. Merge that query back into your main table on Consultant, expand the index column, and remove Consultant before you load the table, so the names never reach the model. Brown, Smith, Rodgers and Tucker come out as 1 to 4. As a bonus you get the name-to-ID table as its own query, in case you want to keep the mapping.