Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Yes, another ranking question! After 2 days of reading and debugging on my own, I've decided it's time to ask you gurus.
How do I fix my ranking so that it ranks all the way to #10, rather than stopping when positive numbers in the rank turn negative?
Metric to Analyze (Rank Top 10) =
var varRank =
SWITCH(
[Current Hierarchy Scope]
,"Zip",[Rank by Zip (Top 10)]
,"County",[Rank by County (Top 10)]
,"Metro",[Rank by Metro (Top 10)]
)
RETURN
varRank
Rank by Metro (Top 10) =
var varRank = RANKX(ALL('Geo - Core Based Statistical Area'),
RANKX (ALL('Geo - Core Based Statistical Area'), CALCULATE([Metric to Analyze (not formatted)])
+ 1-DIVIDE(
[Residential Mail Delivery Points (Per 1K)],
100000000
)
, , ASC))
RETURN
IF (varRank <=10,varRank,Blank())
Current Hierarchy Scope =
IF ( ISINSCOPE('Geo - Postal Code'[Zip]),"Zip",
IF ( ISINSCOPE('Geo - County'[County & State]),"County",
IF ( ISINSCOPE('Geo - Core Based Statistical Area'[Metro]),"Metro",
IF (ISINSCOPE('Geo - State'[State]),"Nationwide"))))
Selection Choice: Rank ID = SELECTEDVALUE('Rank By'[Rank By ID])
Metric to Analyze (not formatted) =
VAR varSelection = [Selection Choice: Rank ID]
RETURN
SWITCH (
TRUE (),
varSelection = 1, [Notice Count],
varSelection = 2, [Notice Count to Housing Units Ratio],
varSelection = 3, [% Change]
)
Residential Mail Delivery Points (Per 1K) = DIVIDE([Residential Mail Delivery Points],1000)
Residential Mail Delivery Points = CALCULATE(sum('Geo - Census By Postal Code'[ResidentialMailDeliveryPointCnt]))
Notice Count to Housing Units Ratio =
VAR varSelectedNotice = [Selection Choice: Notice Code]
RETURN
SWITCH (
TRUE (),
varSelectedNotice = "NOD/LIS", [NOD/LIS % of Residental Deliveries],
varSelectedNotice = "NFS/NTS", [NTS/NFS % of Residental Deliveries],
varSelectedNotice = "NOD", [NOD % of Residental Deliveries],
varSelectedNotice = "LIS", [LIS % of Residental Deliveries],
varSelectedNotice = "NTS", [NTS % of Residental Deliveries],
varSelectedNotice = "NFS", [NFS % of Residental Deliveries],
varSelectedNotice = "REO", [REO % of Residental Deliveries]
)+0
NOD % of Residental Deliveries = DIVIDE([NOD],[Residential Mail Delivery Points (Per 1K)])
NOD = sum('ATTOM Data - Foreclosure'[NOD_NoticeOfDefaultCnt])+0
Solved! Go to Solution.
Well isn't that funny - I guess it just took me writing out all of the steps and digging into the problem in a bit more detail helped me find the solution.
ALLSELECTED, in all occurrences, vs ALL.
"If you forget to ignore the filter context and use VALUES instead of ALLSELECTED, then..."
This is by far the best write up I've found of Rankx over the past couple days that I've been looking.
Well isn't that funny - I guess it just took me writing out all of the steps and digging into the problem in a bit more detail helped me find the solution.
ALLSELECTED, in all occurrences, vs ALL.
"If you forget to ignore the filter context and use VALUES instead of ALLSELECTED, then..."
This is by far the best write up I've found of Rankx over the past couple days that I've been looking.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.