Converting string to geo fields

These are tips 14-15 of my Tableau Speed Tipping session. Refer to the Table of Contents to find the other tips.

  1. Converting string to geo fields

I stumbled across this trick during my first week at The Information Lab Deutschland GmbH.

I spent that week at the Data School in London, and Andy Kriebel was teaching us the fundamentals of Tableau Desktop. (If your German is passable and you’re interested in my experiences during that week, check out this blog post I wrote at the time.)

Somebody asked whether the Superstore field “Region” could be made into a geo dimension, and Andy negated that question. Really, I thought to myself, not necessarily questioning Andy’s expertise but rather trying to understand why Tableau would limit such a thing.

And it turns out that you can, indeed, assign a geographical role to regional fields that don’t conform to Tableau’s understanding of the world. If you have a field with string values such as “North” or “The Americas” or “Hannah’s distribution area” or anything like that, and if you can attribute that to a known area (by countries, states, or postal codes), Tableau will allow you to create a geographic role from that known area.

In my example, I have world regions (a string field) and countries (known geo dimension). Each country belongs to exactly one world region. All countries belonging to each of the world regions are in the data set. So I can assign a geo role to my field Region, created from the field Country. Tableau will compute the area of the regions from the combined areas of the countries.

Andy added this neat trick to his tip battle with Jeffrey Shaffer at TC17. There’s plenty of brilliant tips and tricks to be found in the video.

  1. Colour map background

You are showing locations on a map and wish to change the background colour. Tableau’s map layers give you a couple of options. But let’s assume they don’t have the exact colour you’re looking for. You also don’t want to go to the trouble of using an external mapping service such as Mapbox. Are you stuck now?

No, you’re not. Simply deselect Base under Map Layers, and then go to Format > Shading. When you change the worksheet background now, your map will reflect that colour.

I’m pretty certain that I’ve learned this neat trick from Jeffrey Shaffer in one of his tip battles, but I couldn’t find the video again. He’s done plenty of tip battles and all of them are worth watching.