KNOWLEDGE BASE

Filtering Data Across Multiple Data Sources Using A Set


Published: 29 Jun 2020
Last Modified Date: 23 Mar 2023

Environment

  • Tableau Desktop 2020.2 and later

Answer

The method below uses the Set Control function added in Tableau Desktop 2020.2.

Step 1: Create the initial view

  1. Open Tableau Desktop and connect to the Superstore sample data source.
  2. (If applicable) On the Data Source page, drag the Orders table to the canvas.
  3. Select Data > New Data Source, and then connect to the Coffee Chain data source.
  4. 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.
  5. 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.
  6. Drag Profit and Sales to the Rows shelf.
  7. Right-click Sales, and select Dual Axis.
  8. Right-click the new axis, and select Synchronize axis.
  9. Select Worksheet > New Worksheet and then select the Superstore data source in the Data pane name the sheet superstore.
  10. 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.
  11. Drag Sales to the Rows shelf.
  12. Drag Category to Color, and select Bar from the Marks drop-down list.
  13. 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
  1. With your workbook open and displaying superstore (and the Superstore data source), in the Data window, right click State, Create > Set
  2. Create a Set State Set, select California and Colorado
  3. Create a calculated field by selecting Analysis > Create Calculated Field.
  4. 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.
      [State Set]
  5. Drag State Set to Details of Marks card
  6. Drag State Filter to Filters card and select True
  7. Right click State Set select Show Set
  8. Go to worksheet coffee chain
  9. Drag State Filter from Sample - Superstore to Filters card, select All values > Next > True
Step 3: Use the Set filter
  1. Go to the dashboard, click the drop-down arrow for superstore view, and then select Sets> State Set.
  2. Select a state from the set control.
Did this article resolve the issue?