Previously, we saw how to capture and use Tableau’s automatically generated latitude and longitude for custom geocoding. Now, we’ll extend that technique to give us the ability to drill up and down on various levels of geographic detail in a single visualization:
The data is fairly standard. We have Regions which contain 2 or 3 Areas which contain multiple Zip Codes:
Only Zip Code is recognized as a standard geographic field. Tableau is nice enough to supply the fields Latitude (generated) and Longitude (generated) based on the Zip code. However, we can’t use those fields in calculations or blending. So, we’ll capture them in a separate data source (along with the associated Region, Area, and Zip Code) just like we saw in the previous tip.
Now we can blend between the two sources on any of the fields they share in common:
But why set the level of detail of the blend ahead of time? This gets much more exciting if we create a parameter and a couple of calculated fields to allow the end-user to control the level of detail of the blend.
Here the parameter:
Then, I’ll create a calculated field that returns the desired dimension based on the parameter selection:
We’ll create this calculation in both the primary and secondary data sources. Why? So we can blend on that field instead of any of the others:
And now, the level of detail of the blend changes with the user selection. Instant geographic drill down (and up again!)
Here it is in action: