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: 14

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
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: 9
Upvote 0

Forum statistics

Threads
1,223,760
Messages
6,174,341
Members
452,555
Latest member
colc007

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