Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
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.
Solved! Go to Solution.
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))
)
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".
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.
Also I am using the filter pane on group 1.
Network Rank =
var networks = ALLSELECTED(Hiearchy[Network Name])
return RANKX(ALL(networks), [Incentive SAIFI],,ASC)
The DAX query above gives me this error message.
@Anonymous
You may try the measure below.
Measure =
RANKX (
ALL ( Hiearchy[Group], Hiearchy[Network Name] ),
[Incentive SAIFI],
,
ASC
)
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))
)
@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
Thats exactly what I did when and the last table was my results from that.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 55 | |
| 40 | |
| 35 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 71 | |
| 70 | |
| 38 | |
| 35 | |
| 23 |