Reputation: 3411
Say I have a column with Text data like:
A
B
A
D
I would like to create a new column so that the end result is:
A 0
B 1
A 0
D 2
What is the correct way do this is PowerBI Power Query Editor? I tried a few things like indexing but that gives a unique value to every row. Not very familiar with the API so am a bit stuck here.
Upvotes: 1
Views: 545
Reputation: 3411
We can do something like: List.PositionOf(List.Distinct(Table.Column( #"Table name", "Col")), [Col]))
where Col
is the column name.
Upvotes: 1