6 Replies Latest reply on Nov 20, 2018 2:28 PM by Steve Martin

    Mapping: Maintain static location whilst filtering all other locations

    Steve Martin

      Hi All,


      I kinda feel this should be easy but just cannot think how.


      I'm trying to put together a small tool that will provide information on a given item and, how far visually the selected item is from a static location.


      In short, I want to maintain a station marker on a map and then, use a filter or dashboard action to show one or more addresses on the same map to illustrate the distance from the selected address to the station.


      This can easily be achieved with a parameter, but, parameters are no good due to 1. Single-select and 2. cannot be assigned to an action filter

      This is also not too difficult to achieve use window refs such as index (and a new category header to allow for a second-level window) but, filtering becomes more awkward and crucially this method is not mappable.


      Result is, this is proving to be more problematic.


      So far I have tried:

      • Dual-axis Latitude to place the mark - with two calcs to determine the fixed position in one LOD and a second for the filterable list in the second lod
      • Self-blend with a blend field lit: 'T' to form the blend but this fails to pull through the Lat and Long from the secondary blend
      • Combined Set filter (hoped to use 2018.3 set actions here), but this achieves the same as a standard filter
      • Self joining the source (again on the blend field) and again, this fails


      Any other ideas?



        • 1. Re: Mapping: Maintain static location whilst filtering all other locations
          Sarah Battersby

          I wonder if some modification of a set action linked to distance calculations would help with this?  I'd probably have to look at your dataset to really wrap my head around the use case / problem, but this is just my first guess... I wrote up a blog post on a simple use of set actions for dynamic distance calculations, so if it helps, here is the link: Set actions for dynamic distance calculations



          Tableau Research

          • 2. Re: Mapping: Maintain static location whilst filtering all other locations
            Steve Martin

            Hi Sarah,


            Thanks for your response, I have created a tiny extract so you can get the picture. In this instance, Kings Cross Station is to be the continuous marker with all the other restaurants to be multi-select filterable and/or set-actioned



            • 3. Re: Mapping: Maintain static location whilst filtering all other locations
              Sarah Battersby

              Hi Steve,


              I'm still a touch foggy on the required task, but here is my interpretation of your question... a viz that lets you click (or draw box, etc.) to select establishments, maintain the selection of the station(s) on the map when the selection of establishments is made, allow some sort of display of the distance form selected to the station(s).


              I've put together a quick viz using set actions that allows you to select the establishments and add them dynamically to a set.  That set is then combined with a set that just contains stations, and all are visualized together so that the selected establishments and station are highlighted.  I couldn't figure a good way to remove all of the non-selected establishments and get them back easily (though there may be a way with some creative adjustment of the set action...)


              Is this even remotely close to what you're trying to do?




              1 of 1 people found this helpful
              • 4. Re: Mapping: Maintain static location whilst filtering all other locations
                Steve Martin

                Hi Sarah,


                Thank-you for your efforts so far although this is not what I am looking to achieve - I suspect my description to be the cause of this.



                What I am wanting to show is a table-linked map of Places of Interest (poi) and, the distance from a static location also marked on the map, so when a user selects the place of interest from the map, the map is filtered to the selected place of interest and crucially, the station marker also remains so the user can determine the location and distance the poi is from the station.


                This is a rough-cut of the dashboard, where a user can select the light-bulb to show the restaurant's location on the map:

                Dinner @ KGX


                But, due to Tableau's order of operations, filtering will filter-away the data that holds the marker for the station.


                So far, the most likely candidate would be a self-blend [blended against a generic field that appears on the same row, a value of "T" would work], as this would allow for one set to be filtered to the selected poi, whilst keeping the station in the view too however, in the world of mapping, and of Latitude and Longitude, absolutes are necessary as the built-in postcode functions are too wide, so I have had to provide these such, that the lats and longs from the secondary set do not come through and, to make matters more interesting, when plotting on a dual axis-map, the geo-function of the mapping is removed.


                The only other method I can think of that may achieve this would be to have a duplicate of every poi, with a sub-name, the first row is the poi details, the second would be the station details, these are linked in the data source under the same name and filtering is achieved as such, using the sub-name for all other functions such as shape, name colours etc.

                This method might actually make configuring the paths easier too.



                1 of 1 people found this helpful
                • 5. Re: Mapping: Maintain static location whilst filtering all other locations
                  Steve Martin

                  Yes, my suggested method of my previous post has worked, so whilst this is ok for a simple spreadsheet, the method to employ here for a large set would be a union all statement on the sql.


                  Now just got to setup the paths to see if this will work as expected



                  1 of 1 people found this helpful
                  • 6. Re: Mapping: Maintain static location whilst filtering all other locations
                    Steve Martin

                    So the method to resolving this comes from having dual locations on the filter point.



                    As we know, filters are applied at the data source end of the pipe in Tabelau's order of operations and, for the SQL savvy you will know that the where clause which is what the Tableau quickfilter actually is, is applied second, once all the tables have been gathered and joins applied.


                    So the result is, filtering will therefore remove the rows that contain the additional data we want to keep, from the source, before the data is piped to Tableau for assembly so by using a filter, we have already lost before we have started.

                    One alternate method that may work for anything but mapping, would be the self-blend, that is, to duplicate the data source and use a pre-calculated blend field something along the lines of:

                    [blend] 'T'
                    to setup the relationship so that as other items are filtered away, so long as the relationship is maintained (which it should be as every row of each set will contain the blend field), then this will work, for most but crucially, this method is not available for mapping as all items on a blend are aggregated which includes the Latitudes and Longitudes.




                    The only real sure-fire way to resolving this will be to create a duplicate entry of every lat/long Place of Interest in your source, then with an adjustment in your source to create a secondary field to hold the real location name, and, updating the second entry's detail to that of the intended secondary location, then filtering on the primary location name, will keep both points in the view:


                    1. My Point of Interest name in my data source is called Establishment I then added a secondary column called Actual_Establishment
                    2. Add the value from the Establishment field to the Actual_Establishment field
                    3. Duplicate every entry:
                      1. This is simple in Excel with only 14 locations although might become cumbersome to maintain a massive list
                      2. In a database, this is even easier to maintain as you could read the primary data into and update to a secondary value from within a derived table before Union All the two tables together
                    4. Update the secondary entries from Actual_Establishment onward so now, we will have two versions of say "The Parcel Yard" but each will have a different set of Lat and Long and a different Actual_Establishment
                    5. Update the map keeping Establishment on the LOD, adding the actual_establishment to the text and shapes fields for formatting
                    6. Add a targetted action to the table that filters the map for the Establishment dimension - and for me, using sheets in tooltips, ensure the tooltip filter also uses the same filtering as the action



                    So now, I can multi-filter the table to show one or more establishments on the map whilst also keeping the station in view too.

                    From the attached, hovering over the light-bulb will show a mini-map in the tool-tip but clicking the bulb will filter the main map, and you can select as many bulbs as you like.


                    Workbook downgraded to 10.5 for older versions although the methods mentioned here are compatible down to v6 (2011)




                    View on Tableau Public