1 Reply Latest reply on Mar 24, 2017 12:57 PM by Sarah Battersby

    How can I show path between two locations in a map if origin and destination country code is available

    Ammu G

      How can I show path between two countries shown in a map if origin and destination country code is available?

      Attached the sample file.

      Thanks,

      AG

        • 1. Re: How can I show path between two locations in a map if origin and destination country code is available
          Sarah Battersby

          Hi Ammu G,

           

          You should be able to make a map using a line symbol to show connections between your origin and destination countries.  You'll need to do a bit of manipulation to your data first though. I  have attached a demo workbook with a subset of your data as an example, but the basic things are:

          • For every path you will need a separate row for origin and destination (I added the rows manually in Excel since I was just using a subset of your data for the example, but you could probably write a macro pretty easily to do this)
          • I added in two new columns (PathOrder and Dest_Orig) - these are so that Tableau knows what order to draw the line (destination = 0, origin = 1) and so that we have a unique ID for each destination/origin pair.
          • In Tableau I created a calculated field to list the location for each row (rows with PathOrder of 0 get the destination country code, and rows with PathOrder of 1 get origin country code), and then set the location field to geographic role of Country
            • I had to create aliases for a few of the abbreviated codes so that there wasn't any ambiguity in Tableau - e.g., AU -> Austria... the ones that Tableau sees as ambiguous will be listed as 'unknowns' on the map (look for the unknown data wart in the lower right corner of the map...)
          • Add the location to the map - you'll see a dot at each country location
          • Change mark type to line (you'll see a crazy, snakey line across your map)
          • Add Dest_Origin to detail (on my map it only worked when the Dest_Orig was above the location in the marks card)
          • Now add revenue or whatever attribute you want to color / size to style the lines.

           

           

          Sarah

          Tableau Research

          2 of 2 people found this helpful