7 Replies Latest reply on Jun 24, 2016 10:32 AM by Sujata Bhamre

    Map locations from USA and Canada

    Sujata Bhamre

      I have a column in a table which has data for  province codes from  USA and Canada. ex: PA,MT,MS,AB,BC,CA,DE,CO. There is no column in the table which states the country name.

      I am trying to map all provinces  but  i get few unknown locations.    If i select country/Region as USA the only  US provinces are recognized . The other ones from Canada are shown ambiguous. Next when I edit  select Country as Canada the provinces form USA become ambiguous . How can plot  all provinces from USA and Canada on map. If I select None for Country/Region  some locations  from both US and Canada are ambiguous. 

        • 1. Re: Map locations from USA and Canada
          Shawn Wallwork

          Hi Sujata, you've posted this question in the wrong area of the forums, I'll move it for you. The Questions forums are here. (Bookmark it.)

           

          So when you look at your data in your data source how do you know which is a state and which is a province? If there isn't any way for you to tell the difference, then there's really no way for Tableau to know the difference. However if there is some field (any field) that makes a distinction then you can use logic like this:

           

          IF [Currency] = 'US Dollar' THEN 'United States' ELSE 'Canada' END

           

          Give this a geographic role of 'Country' and put this on the detail shelf and it should clear up your ambiguities.

           

          The only other option you have is to manually put in lat/longs for one set of ambiguous fields. However this won't work with filled maps, because Tableau is still not recognizing this lat/long as a state/province.

           

          Cheers,

           

          --Shawn

           

          EDIT: Didn't realize Ambassadors can't move from the Viz Talk area. Tableau Community

          • 2. Re: Map locations from USA and Canada

            Moved this over!

            • 3. Re: Map locations from USA and Canada
              Sujata Bhamre

              Thanks Shawn for  the reply.

              I understand that country name is important and needs to be specified.

              I  still have a query  why some of the states/provinces are recognized and others are not. All data is from US/Canada.  Ex UT  Utah, MT Montana ,NB,WA are ambiguous.

              But all other like ND,MI,MN,AB,MB  have matching locations. Following is the screen shot.

               

               

               

               

               

               

              Thanks

              Sujata

              • 4. Re: Map locations from USA and Canada
                Shawn Wallwork

                Since you haven't given it any country at all, Tableau is looking through every country's data for the two-digit State abbreviation. And while Canada & US don't share those abbreviations, some other country somewhere in the world do have those abbreviation.

                 

                You could try aliasing all the abbreviations, replacing them with full name. That might get Tableau unconfused.

                 

                Cheers,

                 

                --Shawn

                • 5. Re: Map locations from USA and Canada
                  Shawn Wallwork

                  If that doesn't work then do this:

                   

                  IF [Clm dstate] = 'AB' THEN 'Canada'

                  ELSEIF [Clm dstate] = 'BC' THEN 'Canada'

                  ELSEIF [Clm dstate] = 'MB' THEN 'Canada'

                  ELSEIF [Clm dstate] = 'NL' THEN 'Canada'

                  ELSEIF [Clm dstate] = 'NT' THEN 'Canada'

                  ELSEIF [Clm dstate] = 'NS' THEN 'Canada'

                  ELSEIF [Clm dstate] = 'NU' THEN 'Canada'

                  ELSEIF [Clm dstate] = 'ON' THEN 'Canada'

                  ELSEIF [Clm dstate] = 'PE' THEN 'Canada'

                  ELSEIF [Clm dstate] = 'QC THEN 'Canada'

                  ELSEIF [Clm dstate] = 'SK' THEN 'Canada'

                  ELSEIF [Clm dstate] = 'YT' THEN 'Canada'

                  ELSE 'United States'

                  END

                   

                  Change this field to a geographic role of Country. And put it on the Detail shelf.

                   

                  --Shawn

                  • 6. Re: Map locations from USA and Canada
                    Sujata Bhamre

                    Thanks . This clarifies all doubts.

                     

                    Sujata

                    • 7. Re: Map locations from USA and Canada
                      Sujata Bhamre

                      This works perfect. Thanks for the solution and saving time.

                       

                      Sujata