Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to Create a unique identifier column based on the combination of two columns?

Hi Everyone,

 

My requirement is to create a new identifier column based on the combination of the two existing columns.

For Example, Let us consider this to be the Sample data. We need to create this ID (First column) based on the combination of "Country & PG" column.

 

IDCountryPGAreaAction
1C1P1A1TRUE
2C1P1A2FALSE
1C1P2A1TRUE
2C1P2A2TRUE
3C1P2A3FALSE
1C1P3A1TRUE
1C2P1A1TRUE
2C2P1A2FALSE

 

We need to increment the ID, if the combination of the Country and PG is same. If one of them seems to change, then again we need to start from the index 1. Can anyone please help me in implementing this ID column. It would be really helpful If you could able to give me the solution file or M code. 

 

Thanks in advance!! 

2 Replies