Forum Discussion

longlostlives's avatar
longlostlives
New Member
5 years ago
Solved

Filter Locations by Related Location

I have a table that stores locations that have been selected in a particular session. Here is some example data:

 

Session IDLocationLocation ID
1Washington1
1Dallas2
2Washington1
3Dallas2
3St. Paul3
3Boise4
4Boise4
4Seattle5

 

I want to display the list of locations in a slicer, and then based on the selected location, display all the other locations that have been chosen when that location was selected.

 

Examples:

 

If Washington is selected, then

 

Session IDLocationLocation ID
1Dallas2

 

If Dallas is selected then

 

Session IDLocationLocation ID
1Washington1
3St. Paul3
3Boise4

 

I will then display the locations on a map with the count of session ID used as the size indicator.

 

What's the best way to go about doing this? I have a related table for all Location and Location IDs, and could use that for the slicer although I would ideally just use the list of locations from the main table so only locations that have been selected appear in the slicer list.

 

Thanks in advance!

  • I ended up setting up a table in Power Query to contain all the required data instead of going the DAX route. It does the job and will monitor performance vs. trying again in DAX.

3 Replies

  • Greg_Deckler Thanks for the tip! I am able to get the selector working to display the results in a table, but I'm having trouble making it work when I try to count the Session ID for the map size parameter.

     

    Here's what I have for the 'basic' selector:

    Related Locations = 
    VAR LocationID = MAX([LocationID])
    VAR Location = MAX([Location])
    VAR LocationSelected = VALUES(Locations[Location])
    VAR TableSelected = SELECTCOLUMNS(FILTER(ALL(LocationCities), [Location] IN LocationSelected), "LocationID", [LocationID])
    RETURN
    IF (LocationID IN TableSelected && Location <> LocationSelected, 1, BLANK())

    Any thoughts on how to modify this or set up another measure to use this to determine how many times each related location shows up?

  • I ended up setting up a table in Power Query to contain all the required data instead of going the DAX route. It does the job and will monitor performance vs. trying again in DAX.