KNOWLEDGE BASE

Multi-hierarchical Drill Down Bar Graph


Published: 30 Nov 2020
Last Modified Date: 30 Nov 2020

Question

How to create a bar graph that enables Multi-hierarchical Drill Down by clicking?

Environment

  • Tableau Desktop

Answer

The following example shows how to create a drill down bar graph for Category > Sub-category > Manufacturer in Sample - Superstore.
1. Create a parameter Parameter Category, set the Current value to ALL
2. Create a parameter Parameter Sub-category, set the Current value to ALL
3. Create a calculation filed Category Color to Color Category
IF [Parameter Category]="ALL" THEN [Category] END
4. Create a calculation filed Sub-cat Mfr Color to Color Sub-category and Manufacturer
if [Parameter Category]!="ALL" then
    if [Parameter Sub-category]="ALL" then [Sub-Category]
    ELSEIF [Sub-Category]=[Parameter Sub-category]
    then [Manufacturer]
    END
END
5. Create a calculation field Label to show label
if [Parameter Category]="ALL" then [Category]
elseif [Parameter Category]!="ALL" then
    if [Parameter Sub-category]="ALL" then [Sub-Category]
    elseif [Sub-Category]=[Parameter Sub-category]
    then [Manufacturer]
    END
END
6. Create a calculation field Filter to filter out the selected items
([Parameter Category]=[Category] or [Parameter Category]="ALL")
and
([Parameter Sub-category]=[Sub-Category] or [Parameter Sub-category]="ALL")
7. Drag Order Date to Columns, Sales to Rows
8. Change chart type to Bar
9. Drag Filter to filters card, select True
10. Drag Category Color to Color in Marks card
11. Drag Sub-cat Mfr Color to Detail in Marks card, then change it from Detail to Color
12. Drag Label to Label in Marks card
13. Create a new dashboard
14. Add Sheet 1 to the dahsboard.
15. Select Dashboard > Actions... > Add Action > Change Parameter... to open the Add Parameter Action windows, set it as the following:
Parameter : Parameter Category
Field: Category Color
Aggregation: None
Clearing the selection will: Set value to ALL
16. Select Dashboard > Actions... > Add Action > Change Parameter... to open the Add Parameter Action windows, set it as the following:
Parameter : Parameter Sub-category
Field: Sub-cat Mfr Color
Aggregation: None
Clearing the selection will: Set value to ALL
17. Click each item and assign the color palette to each item
18. Delete the color legend

* Using 2 parameters for Category Color and Sub-cat Mfr Color is to avoid the situation that there are same names in both Category and Sub-category.
Did this article resolve the issue?