Last modified date: 20 Jul 2023
Environment
Tableau DesktopAnswer
Use Table Calculations to display the subtotal and grand total values and use a lookup calculation to filter the view. Using the Excel Superstore subset data source sample, the following instructions can be reviewed in the workbook attached on the right side of this page.CLICK TO EXPAND SOLUTION
Build and Adjust the View with the help of calculated field creations
Step 1 - Build the View
- Drag Profit to Text.
- Drag Category to Columns.
- Drill down on Category, so that the it expands to Sub-Category.
- Drag Region to the Rows shelf.
Step 2 - Create calculated fields
- Create a new calculated field to display the Category Profit per Region.
- Go to Analysis > Create Calculated Field.
- Enter a name, e.g. 'Category Total'.
- Enter the formula: WINDOW_SUM(SUM([Profit]))
- Click OK.
- Drag the newly created calculated field to the view.
- Repeat step 2 to create a new calculated field to display the grand total.
- Enter a name, e.g. 'Region Grand Total'.
- Enter the formula: WINDOW_SUM(SUM([Profit]))
- Click OK.
- Drag the newly created calculated field to the Measure values list.
- Repeat step 2 to create a calculated field to filter what category will be displayed.
- Enter a name, e.g. 'Lookup Sub-Category'.
- Enter the formula: LOOKUP(MIN([Sub-Category]),0)
- Click OK.
Step 3 - Adjust the view
- Move SUM(Profit) value to the top of the Measure Values list
- Move Measure Names from Rows to Columns.
- In the Measure Values list, right click on "Category Total" and select Compute Using > Category.
- In the Measure Values list, right click on "Region Grand Total" and select Compute Using > Table (across).
- Drag Lookup Sub-Category to Filters, select a dimension and click OK.
- Right-click on Lookup Sub-Category and select Show Filter.
Optional
- To change the filter display options, click the drop-down menu on the filter .
- Right-click Measure Names and select Edit Aliases to change the headers in the view.
- Right-click on the Category/Sub-Category header on the view and select Hide Field Labels for Columns.
- Right-click on Sub-Category on the Columns shelf and clear Show Header.
- Right-click on Category on the Columns shelf and clear Show Header.
Additional information
To view these steps in action, see the video below: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