Having a way to drill down into your data can be very useful. They're great for when space is at a premium and for reducing cognitive load for the end user. I'm a big fan and I've used it a few times in my client projects at The Data School.
In the above screenshot, I can click on a Product and it will show me a breakdown of how much each Sub-Product contributes.
Let's not waste any time and get straight to the tutorial (I will be using the Superstore dataset included with Tableau):
The picture below is for demo purposes. This is the structure that we want for our drill down. We want to be able to click on a Category and it shows us all of the Sub-Categories inside that Category. If the Category isn't selected then it stays collapsed.
1. Place Category onto the Rows
2. Create a Set from the Category field
3. Create a calculated field called 'Sub-Category Drilldown' and place this onto the Rows
IF [Category Set] THEN [Sub-Category]
4. Create a Set Action by going to 'Worksheet' at the top left of Tableau and clicking on 'Actions...'. Next click on 'Add Actions' in the new window that pops up
5. Name this Set 'Change Category Set Drilldown' and make sure you have 'Remove all values from set' selected at the bottom right of this window
6. Create another calculated field called 'Category Drilldown with Arrow' and place this field onto the Rows
IF [Category Set] THEN '▼ '
ELSE '▶ '
END + [Category]
7. Ensure that Category is to the left of 'Category Drilldown with Arrows' in the Rows. Then right click on Category and click on 'Show Header'
This way you will be able to both drill up and down without the order of Category changing.
8. As an extension, feel free to jazz it up by using 'Hide Field Labels for Rows', using row banding etc.
* chef's kiss *