Not Applicable is Applicable – Handling ‘N/A’ in Tableau Mapping

Data

Not Applicable is Applicable – Handling ‘N/A’ in Tableau Mapping

by Cory Jez
//

Tableau’s “out of the box geocoding” functionality creates a wealth of opportunities for users to create beautiful maps almost instantly. This is continually one of the most “in-demand” sections for students who have attended my Tableau trainings. There are few other software applications which are this flexible and quick to build in geospatial analyses, and users are anxious to implement them.

Tableau can map fields with several different geographic roles:

Role Description
Area Code US Only
CBSA / MSA US Only
City Worldwide
Congressional District US Only
Country Worldwide, includes names and characters
County US Only
Latitude / Longitude Worldwide, numeric fields only
State / Province Worldwide, includes abbreviations and names
ZIP Code / Postal Code Select Countries

The beauty of these roles is that we do not need the latitude or longitude in our dataset. Tableau knows it for us!

The Issue 

International analyses often want to map at the level of “Country,” comparing one sales figure to another around the globe. Even further, Tableau understands country codes (i.e. “US”) and names (i.e. “United States”). While this gives us a lot of flexibility, in a recent training course, one student pointed out that this could also present an issue. They had a simple challenge:

“It maps data to Africa, specifically Namibia, when all I have is Europe in my dataset.”

I thought this seemed odd, as the student was certain they only captured data for Europe. So, we started digging. I’ve recreated a dummy dataset below to investigate. The student’s map looked something like this, and sure enough, there were sales in Southern Africa

Student Map

Investigating with a Crosstab

Whenever presented with a quandary like this in Tableau, its best to do some ad hoc investigation to figure out what’s going on. We opened up a new sheet and built a simple crosstab to see what was going on:

N/A in Dataset

Sure enough, there wasn’t any data for Namibia in his dataset, but there was an “N/A” – a field commonly used to denote “Not Applicable.” Apparently, Tableau can also consume a “/” inside of a country code, as the code for Namibia is NA. How then should we account for this? 

Tableau has a great option for renaming locations which are currently listed as NULLs. This is available by right-clicking in the map and selecting “Edit Locations.” This works great to transform a NULL into a desired country name, but we can’t transform something BACK to a NULL.

Hmm … what to do, what to do.

The Solution

The best solution I’ve found so far is to dynamically rename any Country field of “N/A” as “NULL.” That way, Tableau will not map it. The calculated field looks something like the following:

Calculated Field N/A to NULL

From here, we can map “Renamed Country” instead of “Country Name.” We get a map that has one NULL and only shows Europe:

New Tableau Map

Can you think of any other way you would handle an issue like this? We tackle nuances like this and many others in our Tableau training classes. You can learn more about Tableau training from InterWorks at our Tableau Training page.

More About the Author

Cory Jez

Business Intelligence Analyst
2014 FIFA World Cup Visualized in Tableau – Group G Outcomes If you cried as much as I did as the U.S. Men’s National Team settled for a draw against Portugal last night, then you’ve probably ...
Not Applicable is Applicable – Handling ‘N/A’ in Tableau Mapping Tableau’s “out of the box geocoding” functionality creates a wealth of opportunities for users to create beautiful maps almost ...

See more from this author →

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072

×

Love our blog? You should see our emails. Sign up for our newsletter!