Last Modified Date: 24 Aug 2022
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] END4. 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 END5. 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 END6. 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
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:
17. Click each item and assign the color palette to each itemParameter : Parameter Sub-category
Field: Sub-cat Mfr Color
Aggregation: None
Clearing the selection will: Set value to ALL
Field: Sub-cat Mfr Color
Aggregation: None
Clearing the selection will: Set value to ALL
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.
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials