DAX - correct use of RANKX

Mike_R_

New Member
Joined
Jan 12, 2019
Messages
7
Dear Colleagues,
I wanted to practice with DAX but I got stuck incorrectly working RANKX function.
I worked on adventureworks data, Person_person table.
In 3rd column of upper table I counted occurances of persontype.
In next colummn I wanted to create a ranking using RankX function, therefore I created new measure as per attached printscreen (ranking = rankx('Person Person',count('Person Person'[PersonType]),,,Dense).
However a result of such ranking is 1 (last column in table)!
Can you please advise on how to fix the issue? I supose I need to modify DAX function...

Thanks in advance for help and reply!

Mike
 

Attachments

  • printscreen.png
    printscreen.png
    116.7 KB · Views: 12

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
When using RANKX, you are ranking an individual against all others. But the first parameter (the table) also receives the filter from the visual. So you have to first remove the filter. So wrap the first parameter inside ALL, like RANKX(ALL(person), etc
 
Upvote 0
Thanks very much for information Matt. However after applying ALL prior to table, it did not change anything (still I have 1 everywhere).
Maybe I need to apply ALL also while having count function in 2nd parameter....
Can you please advise?
 

Attachments

  • DAX rankx not working.png
    DAX rankx not working.png
    13.9 KB · Views: 7
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,298
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top