4 Replies Latest reply on Feb 22, 2017 4:19 PM by Max Gurrola

# Can tableau map numbers by state based on the code area of the phone number?

I have a list of 20,000 phone numbers, all from united states.

I have it in 2 formats:

+1 10digits

10 digits

Can tableau map those numbers by state based in the code area of the number?

It seems like it can but for some reason I am not able to make it work.

• ###### 1. Re: Can tableau map numbers by state based on the code area of the phone number?

Max,

Yes, Tableau can use Area Code (U.S.) as a geographic role. It sounds like you just need a calculated field to isolate the area code from your phone numbers, taking into account the possible variances in format.

Without seeing the exact data, I'm thinking something like this:

[Area Code]

```IF STARTSWITH([Phone Number], '+1')
THEN MID([Phone Number], 3, 3) // Assumes no space between the "+1" and the start of the area code
ELSE LEFT([Phone Number], 3)
END
```

Hope that helps! If you still run into problems, please attach a packaged workbook, and we can take a closer look at what's happening. Thanks.

• ###### 2. Re: Can tableau map numbers by state based on the code area of the phone number?

Hey James thanks here is the file with the numbers in csv format and the workbook I was trying to work on.

So you are saying basically that tableau cant take the whole number i have to cut the remainder of the number and leave the 3 first code digits?

• ###### 3. Re: Can tableau map numbers by state based on the code area of the phone number?

Max,

Thanks for sharing the workbook. Here is some additional insight:

• Yes, you have to have a field that contains just the area code.
• Fortunately, you seem to have every phone number with and without the international calling code, so your Area Code extract calculation is going to be very easy: it's just LEFT(STR([Phone no cc]),3)
• Once I tested this, I realized that Tableau can't do filled maps from Area Code data. It doesn't have boundary information for each area code, only centerpoint data.
• It sounds like what you really want to do is map the area code to a state, in order to aggregate customers by state. In that case, Tableau's geographic roles won't help you. You will need to bring in an additional source of data to map area codes to states. Here is one place where the information exists: Area code list in numerical order. Obviously you will need to do a bit of cleanup before bringing this into Tableau. Once you have this data source incorporated, you can cross-reference it (either via a cross-datasource join or data blending) to bucket your customers by state — and once you have that, Tableau will handle the boundaries for you.
• If, on the other hand, you want to show what portion of the state is covered by the area code, then once again, Tableau won't help you. You're going to need a data source that defines geospatial data that you can render on a Tableau map. Here is an example of geospatial boundary data for area codes, courtesy ArcGIS: https://www.arcgis.com/home/item.html?id=42bedaaf4e154f4b872afc167a736853. I don't have experience converting external geospatial data for use in Tableau maps, but there is a wealth of information on the topic from Tableau gurus. Here's a good place to start: How to map geographies in Tableau that are not built in to the product (e.g. UK postcodes, sales areas) – Dabbling with …  (see in particular "Option 4 – Convert a 'shape' file")

I hope this helps!

1 of 1 people found this helpful
• ###### 4. Re: Can tableau map numbers by state based on the code area of the phone number?

Thanks!