Relatively new to Power BI and DAX so I’m needing a little guidance. I’ve attempted to follow a few other forum posts and videos but have had no luck.
I have a set of data that consists of about 600 cities, I want to be able to select any city within that set and then based on the population, compare to the data I have in 200 of those cities.
I currently have a measure that will put a 1 or 0 based on the input from a slicer
Filtered Selection =
VAR SelectedPlan = SELECTEDVALUE( ‘City Names - Disconnected’[Name Only] )
VAR CurrentPlan = SELECTEDVALUE( Demographic[Name Only] )
VAR Active = SELECTEDVALUE( Demographic[Always Include?] )
I am wanting to use RANKX to rank (based on population) only the values that return a 1
(I have an overall ranking that works but is for all 600 cities)
First thought was
Filtered Rank = RANKX( FILTER( Demographic , [Filtered Selection] = 1 ) , [Population] , , DESC , Skip )
but that only returns a value of 1 for every rank, I have also attempted a virtual table that gives me the same result (Selection Table Measure)
My goal after getting those rankings is to show the details of the rankings 5 above and 5 below the selected value.
I am no Guru
but with the RANK you need something like
[Rank Population] =
IF ( HASONEVALUE( ‘City’[City Name]),
RANKX(ALL(‘City’[City Name]), [Population])
)
Thats assumoing you are ranking by City Name. I made it ALL so that it RANKS ALL. Just replace that with the filtered version but make sure you get ALL of the filtered data
My problem is I want to add another filter (the 5 above and 5 below) using the rankings returned in the ALLSELECTED() measure above. once I start to work on that problem the rankings change when I apply new filters since I’m using the ALLSELECTED() function.