Forum Discussion
Using RANKX with Filtered Column
So I'm using the RANKX function to rank my networks by my Incentive SAIFI and it works perfect when I'm showing all networks. However when I apply a filter the rank start over. I'm want the networks to keep the same RANK. My latest DAX and example is below.
Network Rank =
var networks = ALLSELECTED(Hiearchy[Network Name])
return RANKX(ALL(networks), [Incentive SAIFI],,ASC)
Raw Table
Group Network Incentive SAIFI Rank (Measure)
| 1 | A | 12.3 | 12 |
| 1 | B | 12.5 | 14 |
| 1 | C | 10.3 | 9 |
| 1 | D | 13.3 | 16 |
| 2 | E | 5.9 | 3 |
| 2 | F | 7.7 | 5 |
| 2 | G | 9.9 | 7 |
| 2 | H | 8.9 | 6 |
| 3 | I | 11 | 11 |
| 3 | J | 3.9 | 1 |
| 3 | K | 12.8 | 15 |
| 3 | L | 6.7 | 4 |
| 4 | M | 5.7 | 2 |
| 4 | N | 10.8 | 10 |
| 4 | O | 10.2 | 8 |
| 4 | P | 12.4 | 13 |
Expected When Filtering Group 2
Group Network Incentive SAIFI Rank (Measure)
| 2 | E | 5.9 | 3 |
| 2 | F | 7.7 | 5 |
| 2 | G | 9.9 | 7 |
| 2 | H | 8.9 | 6 |
What I'm actually getting (with a previous measure, not the one above, I've been trying so many things)
Group Network Incentive SAIFI Rank (Measure)
| 2 | E | 5.9 | 1 |
| 2 | F | 7.7 | 2 |
| 2 | G | 9.9 | 4 |
| 2 | H | 8.9 | 3 |
Thanks in advance for the help.
- Anonymous6 years ago
That didn't work for me and still the table is much bigger than I'm letting on. I don't want to just post the full raw table with company info.
I would have loved to have gotten this working with a measure but I gave up and created a calculated table. Below was my calculated table.Network Rank = UNION( SUMMARIZE(CALCULATETABLE(VALUES(Hiearchy[Network Name]), Hiearchy[Group] = "Group1", Hiearchy[Network Name] <> BLANK()), Hiearchy[Network Name], "Rank", RANKX(ALLSELECTED(Hiearchy[Network Name]), [Incentive SAIFI],,ASC,Skip)), SUMMARIZE(CALCULATETABLE(VALUES(Hiearchy[Network Name]), Hiearchy[Group] = "Group2", Hiearchy[Network Name] <> BLANK()), Hiearchy[Network Name], "Rank", RANKX(ALLSELECTED(Hiearchy[Network Name]), [Incentive SAIFI],,ASC,Skip)), SUMMARIZE(CALCULATETABLE(VALUES(Hiearchy[Network Name]), Hiearchy[Group] = "Group3", Hiearchy[Network Name] <> BLANK()), Hiearchy[Network Name], "Rank", RANKX(ALLSELECTED(Hiearchy[Network Name]), [Incentive SAIFI],,ASC,Skip)), SUMMARIZE(CALCULATETABLE(VALUES(Hiearchy[Network Name]), Hiearchy[Group] = "Group4", Hiearchy[Network Name] <> BLANK()), Hiearchy[Network Name], "Rank", RANKX(ALLSELECTED(Hiearchy[Network Name]), [Incentive SAIFI],,ASC,Skip)), SUMMARIZE(CALCULATETABLE(VALUES(Hiearchy[Network Name]), Hiearchy[Group] = "Group5", Hiearchy[Network Name] <> BLANK()), Hiearchy[Network Name], "Rank", RANKX(ALLSELECTED(Hiearchy[Network Name]), [Incentive SAIFI],,ASC,Skip)) )
8 Replies
- amitchandakSuper User
Anonymous
Try like
Network Rank =
var networks =
return RANKX(ALLSELECTED(Hiearchy[Network Name]), [Incentive SAIFI],,ASC)For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale- AnonymousNot applicable
Thats exactly what I did when and the last table was my results from that.
- Greg_DecklerCommunity Champion
How are you filtering? Via the filter panel? If so, then things are pre-filtered and inaccessible to DAX. Can you create a column for your ranking? Then it would "stick".
- AnonymousNot applicable
Apologies, I see I didn't give enough info. If this is possible in a column, I would like for the rank to start over after each group. However when filtered on a group or subgroup, I would like for the rank to not change. I hope I was clear and thanks for your responses.
- AnonymousNot applicable
Also I am using the filter pane on group 1.