Last Modified Date: 13 Feb 2017
AnswerNote: In Tableau Desktop 10.0 and newer versions, you can use filters across multiple data sources. For more information, see Filter Data Across Multiple Data Sources.
The below example uses the Superstore and Coffee Chain data sources, and can be seen in the attached packaged workbook.
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 CoffeeChain Query table to the canvas, and then click the sheet tab.
- 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.
- 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 Sheet 1 and Sheet 2 to the canvas.
Step 2: Create a custom parameter and use it in a calculated field
- With your workbook open and displaying Sheet 1 (and the Coffee Chain data source), in the Data window, click the drop-down arrow at the top of the Dimensions pane, and then select Create Parameter.
- For Name, type Select State.
- For Data Type, select String.
- For Allowable Values, select List.
- Under List of Values, select Add from Field > Sample - Coffee Chain > State.
- When finished, click OK.
- 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.
- Note: This calculation checks whether the state selected in the parameter matches the state field in your data source, and then returns true or false.
- Drag State Filter to the Filters card.
- In the Filter dialog box, select True, and then click OK.
- Go to Sheet 2 (that uses the Superstore data source), and repeat steps 3 to 5.
- Note: You do not need to recreate the Select State parameter.
Step 3: Use the parameter
- Go to the dashboard, click the drop-down arrow for one of the views, and then select Parameters > Select State.
- Select a state from the parameter control.
- Note: Views that use either or both data sources refresh to show data from the selected state.
Additional InformationTo view these steps in action, see the video below:
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Training and Tutorials