Search code examples
powerbidaxm

Add Index without unique values - Power BI / DAX / M


I have a column with Countries (in a table, the column have duplicates) and I need to order them with a index:

  Countries, Desirable index
    A        1
    B        2
    B        2
    C        3 
    D        4
    D        4
    E        5

I can't remove the duplicates because I need the other columns for reference

thanks


Solution

  • Create a table of only distinct countries, index that table, then merge/join that table back to your existing table (the one with duplicates) and expand the index column you just created.