Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Rankx not working in a table with multiple fields

Hi all, thanks in advance for taking the time to read my post and helping me out. I'm trying to create a ranking measure for top spenders in a travel and entertainment report and then place that ranking in a table vizualization with other relevant fields (Expense Type, Employee Name, etc.) I've done a good bit of research through this community and can't seem to identify the issue. Here's the equation I use for the ranking.

 

RANKX( ALLSELECTED(Table1[Employee ID]), CALCULATE(SUM(Table1[Spend USD])) , , DESC, SKIP)

 

I've also tried:

 

RANKX( ALL('Table 1'), CALCULATE(SUM(Table1[Spend USD])) , , DESC, SKIP)

 

The first equation returns the proper ranking but if I add any other fields into the table vizualization it will either throw off the ranking or return 1's

The second equation only returns 1's 

 

The goal here is to be able to create this ranking and select TOPN spenders so I can put that into a slicer and allow users to select the top spenders with ease while still having the other relevant fields in the table vizualization. I haven't made enough progress with the RANKX function to test out using TOPN for a slicer but all suggestions are welcome. Let me know what I'm doing wrong here and how I should go about solving this. Thank you all so much for the input 🙂

4 Replies