Forum Discussion
Create unique ID
Hi
I have one table DimEmployee with employee data and it contains column named Country . I want to create calculated column to generate unique key for each country. so in below example column like "CountryId". How to do this ?
Yes just use Rank
this will give them a unique id based on alphibetial order of country
Column =RANKX(Table1,Table1[Country],Table1[Country],ASC,Dense)
3 Replies
- AnthonyTilleySolution Sage
The easiest way to do this is to just add a manually entered table with ID and Country
you can the join on the country to get the id
if you are wanting to dynamically create an id because you do not know what the country names will be then use a RANKX colunm will give a unique number for each country
Column =RANKX(Table1,Table1[Country],Table1[Country],ASC,Dense)- AnonymousNot applicable
I want to do it dynamically and I do not have any country table so I want to do this in DimEmployee itself. Is it doable ?
- AnthonyTilleySolution Sage
Yes just use Rank
this will give them a unique id based on alphibetial order of country
Column =RANKX(Table1,Table1[Country],Table1[Country],ASC,Dense)