top of page

How to Create a Drill-Down Map

Updated: Jul 12, 2022

If you are new to Tableau you may be aware of Hierarchies and drill-down options with them. In a previous blog post, I listed steps on how to create a drill-down bar chart using a parameter here.


Would you want to drill-down to a State and see if the Cities in that State? Did you know you can achieve this by using Set Actions? Set Actions enable your users to interact directly with your dashboard. For more information on Set Actions, please refer to this Tableau Help link

I created the below dashboard (LINK) modifying the steps in this Phdata article by Spencer Baucke.


Main View

Drill-down View

I'm connecting to the famous Sample - Superstore data set from Tableau. For this dashboard we will need to create a couple of sets.


First I right-clicked on State and selected Duplicate. Then I renamed this field State String. I formatted it as a string field.

Then I right-clicked on State String and created a set without clicking any of the boxes for the states. I labeled this State String None Set.



Then I created another set from State and selected all of the States. I labeled this State String All Set. You can select the Use all radio button or select the All button.



Next I created a calculated field called City View with the following calculation;

If [State String None Set]

Then [City]

ELSE NULL

END


I set the geographic role of this calculation to City. The drill down will not work if this step is missed.


Then I created a calculated field called State View with the following calculation;

If [State String None Set]

then Null

Else [State]

END


I made sure I set the geographic role of this calculation to State.


Then I created the view of the map on the worksheet. I placed City View and State on the Detail Marks card. This automatically placed the Longitude on the Columns shelf and the Latitude on the Rows shelf.

I selected the Map from the Chart Marks type drop-down.

I then added another Latitude pill on the Rows shelf and made this metric a Dual Axis with the other Latitude pill.


Next I clicked on the first Latitude pill on the Rows shelf and replaced City View with the State View calculated field. This automatically added all of the states and made them a blue color. I also replaced the State value with the State String value.



I changed this color to the grey below the white on the Color Marks card. I also put the opacity down to 51%.


I like to remove the Background Layers to my dashboard. So I went to the Map menu and select Background Layers. I unchecked all of the boxes in the layers.

I also hid the indicator that stated 49 unknown.


I created the following calculated field;


Profitable?

If [Profit] > 0 then "Profitable"

Else "Not Profitable"

END


I placed this on the Color marks card of the second Latitude marks card.



I changed the color of Profitable to blue and Not Profitable to a dark red.


I also placed the State String All Set to the Filters Marks card.


Then I put this worksheet on a Dashboard. Then I needed to create two actions.

I created the first Dashboard action titled Cities Drilldown as shown below;



The above set action allows the user to

Drill down to the city level. When the values are cleared, or the user clicks on the state again, it will zoom out with the help of the second set action below.


The second Action was set up as below;



Last I modified the title to the worksheet to explain the actions.

693 views0 comments

Comments


bottom of page