Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Dax query for finding ranks based on multiple dimension fields

Hello All,

I am facing issues with a dax for ranking in power bi

Following is the sample Dataset

 

I have to rank part number for each Vehicle such that it looks like this in the matrix visualization

To add more context,  what we need help is in ranking part nbr with respecto Vehicle and Lines . Basically for a vehicle there should be a unique rank for every part nmbr. The pattern is that, partnmbr with the highest line value should be ranked one. If a couple or more part nmbrs have same line value then the least partnmbr will take precedence and be ranked one and then the next and so on.

Thanks a lot for your help.

 
 

2 Replies

  • Anonymous , Create 2 new column and try

     

    New Part =
    [line] *100 + rankx(filter(Table, [Part Number] = earlier([Part Number]) && [Line] =earlier([line]), [part number],,desc)

    Rank = rankx(filter(Table, [Part Number] = earlier([Part Number]) ), [New Part ],,desc)

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak tried this, this is not working, if the sum of lines is same, then the ranks are also same.