How to create: Month to Day Drilldown

by Nermine Obeng

How to create a Month-to-Day drilldown chart.

Gif of the month-to-day set drilldown

-To start with, we will create the base view. Drag 'Sales' to Rows and right-click and drag the 'Order date' dimension to columns - select the green MONTH(Order Date).

-Next, create a custom date to select the months.

Creating a custom date

-From the newly created custom date (months), we are going to create a set.

Creating a Set from the custom date

-Now, we need to make a calculated field that tells Tableau how to drill into the data. The IF statement states that if a month is in the months set then show the day (else return the custom month).

The calculated field that tells Tableau how to drill into the data

-Right-click and drag this newly created calculated field to the columns shelf and select 'Continuous'.

The drilldown calculated field in the columns shelf

-Drag the custom date 'Months' to 'Path' on the marks card and drag the months set onto 'Colour'. The month view of the line graph is 'OUT' of the set and once you have drilled down to the day view, the graph will be 'IN' the set.

The marks card

-Now to create the set action. Select the worksheet tab in the toolbar, select 'Actions' (or Ctrl + Shift + A), and add a set action. The image below shows the settings you require.

Setting up the set action for the drilldown

-After the action has been created you will see that when you select a month the graph also shows the days in the same view. However, we want the month view to disappear and only show the days. To do this, a couple more calculated fields are required.

-First, we want to specify what happens if a month has been selected. This is done with a table calculation. Working backward, the IF statement allows the months set to return either  '1' or '0'. The MAX is necessary because table calculations required aggregated fields (without it there would be an error in the calculation). WINDOW_MAX returns the max of the statement (the max of 1 and 0).  

The table calculation 

-To show the months in the set create another calculated field. If the month in the set is equal to 0 (no months have been selected) then return true. Otherwise, return the months set (this is wrapped in MIN because Months in Set is a table calculation so an aggregate must be created).

Show months in set calculation 

-Now, drag the 'Show Months in Set' calculation to the filters shelf and it will default to true.

-However, the table calculation needs to be edited. Select specific dimensions and click all the checkboxes available so it computes across all these dimensions.

Setting up the table calculation 

-Double check the filter still says 'True', and there you have it.

Your Month-to-Day Drilldown should now be fully functioning!