#Techtips: How to create a Standard Zoom Level in Maps when having 1 data point?

In this blog we share a #techtipp that will improve your data skills.  These tips come from our certified consultants who work with these tools on a daily basis. Do you have a handy tip for everyone? Please let us know.

This week it’s up to our colleague Monique Damveld: How to create a Standard Zoom Level in Maps when having 1 data point?

Solution

Normally, Tableau needs multiple data points to define the correct level of detail in its maps. Tableau will automatically zoom out when you are only showing one data point in the view. This can be solved by making use of two additional (fake) data points, after which you use the map layers to only show the original data point. An explanation regarding this solution can be found below.

Step 1: Create additional data points

Next to the original data points, you need two additional (fake) data points. Add 2 rows to your data in the following way:

ID  Referentie ID 
1  NULL 
2  NULL 
NULL  A 
NULL  B 

Step 2: Filtering

In your map sheets, you will need a Calculated Field (IND_ID) to filter on the original data point AND the created two reference fields.

IND_ID 

[ID] [PM_ID] 

or 

[ReferentieID] = A 

or 

[ReferentieID] = B 

[PM_ID] is a parameter which you can use to filter on the correct original data point throughout your dashboard.

 

In all other sheets, you can set a filter on “ID” and exclude the “NULL” values.  

Step 3: Define the standard zoom level

The two fake data points are used to define the correct standard zoom level within maps. The Longitude or Latitude of the original data point are taken as the starting point. First, you define what the Longitude (or Latitude) of the selected data point is (Longitude_ID). Thereafter, you define the Longitude (or Latitude) of the reference points (Longitude_ReferenceID).

Longitude_ID

{ FIXED : Max (if [ID] = [PM_ID] then [Longitude] end }

Longitude_ReferenceID

If             [ReferenceID]   = 1         then [Longitude_ID]      + X

Elseif     [ReferenceID]   = 2         then [Longitude_ID]      – X

 

The value put in at X will define the final standard zoom level on the map.

 

Step 4: Create Map

  • Columns: Longitude_ID; Measure = AVG. In this way you will take the average over the original data point (ID) and the fake data points (Reference IDs), which ensures that you are always showing the correct location.
  • Rows: Latitude
  • Detail: Reference_ID
  • Mark type: Shape

Result

Map showing all 3 data points (ID + Reference IDs).

  • Create new layer by drag & drop of the ID field. (You can recognize this field by the red square)

You can adjust the order of the layers by “Drag & Drop” of the layers within the Marks pane.

  • Select the “eye” in front of Reference ID to hide this layer from the view.

You have now created a map with the desired zoom level, without showing the “fake” data points. By making use of the Calculated field you have the possibility to adjust the zoom level easily. In case you want the users to be able to adjust the zoom level, you might replace the hardcoded X value by a parameter.

Gratis Tableau workshop

Wil jij kennismaken met de uitgebreide mogelijkheden van Tableau Software?
Kom dan op donderdag 17 februari naar BCN Nederland in Utrecht (Locatie Daltonlaan 100).

Neem je eigen laptop mee en ervaar de kracht van Tableau in slechts 4 uur.
Tijdens deze training workshop kom je in contact met andere data professionals en kunnen ervaringen worden gedeeld.

Meer informatie & inschrijven