Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Need help to rank non numeric data

 I have recently stated working on power bi and I'm struggling with this below mentioned scenario. your help will be appreciated 🙂   I wanted to rank some non character data in power bi using a measure. if there are two product id matched to one type it should rank them in alphabetical order. 

 

can you guys help ->       amitchandak Fowmy AllisonKennedy lbendlin 

Data :

Product Idtype
11456A
11456B
11457A
11458A
11458B
45821B

 

 

Output 

 

Product IdtypeRank
11456A1
11456B2
11457A1
11458A1
11458B2
45821B1
  • You can try this as a calculated COLUMN:

    Rank Dax = RANKX(FILTER(ALL('Table'), 'Table'[Product Id] = EARLIER('Table'[Product Id])), 'Table'[type],,ASC)

7 Replies

  • AllisonKennedy's avatar
    AllisonKennedy
    Icon for Community Champion rankCommunity Champion
    You can try this as a calculated COLUMN:

    Rank Dax = RANKX(FILTER(ALL('Table'), 'Table'[Product Id] = EARLIER('Table'[Product Id])), 'Table'[type],,ASC)
    • Anonymous's avatar
      Anonymous
      Not applicable

      getting error as parameter is not of correct type in earlier function

      • AllisonKennedy's avatar
        AllisonKennedy
        Icon for Community Champion rankCommunity Champion
        are you doing as calculated column or measure? What is the exact error message you're getting?