By: Rosario Gauna @rosariogaunag
The challenge that @AnnUJackson prepared for week 44 of #WorkoutWednesday, requires the use of “Set Actions”, a new functionality included in the recently released Tableau 2018.3 version.
This new functionality offers a wide range of new possibilities for the user to control aspects of the analysis and its basic operation consists of:
- The “Set Actions” take an existing “Set” and according to the “Mark” or “Marks” selected by the user in the visualization, it updates the values or elements contained in that “Set”.
- And since the “Set” is used in the definition of the visualization, when the elements of the “Set” are rewritten, the visualization is updated.
In the challenge of this week it is required that within the same treemap chart, we can offer interaction between three different granularity levels, using the “Set Actions”.
- Level 1: Category
- Level 2: Sub-Category
- Level 3: Product Name
Step 1: Create a first “Set” called “Category Set”.
To do this, you must position in the Category field and with the right click select the “Create Set” option.
Once the “Set” is created, the initially selected members do not matter, since as we saw, this definition is temporary and will be overwritten when applying the corresponding “Set Action”.
Step 2: Create a dynamic dimension called “Sub-Category-DD”.
The new dimension will be assigned the value of the Sub-Category, only if the Sub-Category belongs to one of the Categories of the “Marks” selected by the user, that is, the Category is found as a selected element in the “Category Set”. Otherwise, it will be assigned the value of a null “string”.
|Sub-Category-DD = IIF([Category Set], [Sub-Category], “”)|
Step 3: Create a second set called “Sub-Category-DD Set”
To do this, you must position in the “Sub-Category-DD” field and with the right click select the “Create Set” option.
Step 4: Create a dynamic dimension called “Product-DD”.
The new dimension will be assigned the value of the “Product Name”, only if the Product belongs to one of the “Sub-Categories-DD” and “Category” of the “Marks” newly selected by the user. Otherwise, it will be assigned the value of a null “string”.
|Product-DD= IIF([Category Set] AND [Sub-Category-DD Set], [Product Name], “”)|
Step 5: Calculate the dynamic label to be displayed in each mark of the chart, according to the level of detail of Drill-Down of each mark.
UPPER(IIF([Product-DD] <> “”, [Product-DD],
IIF([Sub-Category-DD] <> “”, [Sub-Category-DD], [Category])))
Step 6: Create the Treemap chart.
Define the chart with the following variables:
Step 7: Create the “Set Actions”.
Inside the worksheet create a “Set Action” for each of the “Sets” used.
Next, we will proceed with the definition of the chart of monthly sales lines
Step 8: Create a dimension called “Month”
|Month = DATE(DATETRUNC(‘month’, [Order Date]))|
Step 9: Create a new set called “Month Set”
To do this, you must position it in the “Month” field and with the right click select the “Create Set” option.
Step 10: Define the line chart
Move to the shelves of:
- Columns ⬅Month
- Rows ⬅Sales
- Filter ⬅Region – Shared filter between both charts
Step 11: Proceed to create a new “Set Actions”.
Use the following definition:
It’s important to note that unlike the first two “Set Actions” created in step 7, the latter must specify that when the user’s selection is deleted in the view, all values must be added to the “Set”.
Step 12: Include a new shared filter to apply in both charts.
This filter is for displaying only those elements that are active or “In” within the Set: “Month Set”.
Step 13: Adjust the tooltips and the formats.
I take this opportunity to thank @AnnUJackson, for providing the ideal opportunity to try this exciting new feature of Tableau 2018.3.
If you have any questions about the blog, do not hesitate to contact me on twitter (@rosariogaunag)
Examples of the execution of the “Set Actions” in the DrillDown: