The method below uses the Set Control function added in Tableau Desktop 2020.2.
Step 1: Create the initial view
- Open Tableau Desktop and connect to the Superstore sample data source.
- (If applicable) On the Data Source page, drag the Orders table to the canvas.
- Select Data > New Data Source, and then connect to the Coffee Chain data source.
- On the Data Source page, drag the Coffee Chain Query table to the canvas, and then click the sheet tab, name the sheet coffee chain.
- Drag Date to the Columns shelf.
- On the Columns shelf, click the plus icon next to Year (Date) to also show Quarter, and Month. Remove Quarter.
- Drag Profit and Sales to the Rows shelf.
- Right-click Sales, and select Dual Axis.
- Right-click the new axis, and select Synchronize axis.
- Select Worksheet > New Worksheet and then select the Superstore data source in the Data pane name the sheet superstore.
- Drag Order Date to the Columns shelf.
- On the Columns shelf, click the plus icon next to Year (Order Date) to also show Quarter, and Month. Remove Quarter.
- Drag Sales to the Rows shelf.
- Drag Category to Color, and select Bar from the Marks drop-down list.
- Create a new dashboard, and then drag superstore and coffee chain to the canvas.
Step 2: Create a Set and use it in a calculated field
Step 3: Use the Set filter
- With your workbook open and displaying superstore (and the Superstore data source), in the Data window, right click State, Create > Set
- Create a Set State Set, select California and Colorado
- Create a calculated field by selecting Analysis > Create Calculated Field.
- In the calculated dialog box, complete the following steps:
- In the name box, enter State Filter.
- In the formula box, enter the following, and click OK when finished.
- Drag State Set to Details of Marks card
- Drag State Filter to Filters card and select True
- Right click State Set select Show Set
- Go to worksheet coffee chain
- Drag State Filter from Sample - Superstore to Filters card, select All values > Next > True
- Go to the dashboard, click the drop-down arrow for superstore view, and then select Sets> State Set.
- Select a state from the set control.