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:
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.
1 of 1 people found this helpful
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!