Last Modified Date: 22 Mar 2019
AnswerUpgrade to Tableau Desktop 2018.3 or a newer version and use Set Actions. The attached example workbook uses the sample data set Superstore to demonstrate the following directions:
- Create a table that contains one field with the names of all worksheets. This example uses an Excel sheet with the field [View].
- In the existing workbook, create a new connection to the data source from step 1
- Create a new worksheet with [View] on the Rows shelf. In this example, the worksheet is named "Source Sheet"
- Right-click [View] in the data pane and select Create > Set...
- In the Create Set dialog, name the set and click OK. In this example, the set is named "View Set"
- Select Analysis > Create Calculated Field
- In the Calculated Field dialog box that opens, do the following, and then click OK:
- Name the calculated field. In this example, the calculated field is named "Is Map?"
- In the formula field, create a calculation similar to the following:
MAX(IF [View Set] THEN [View] END = "Map")
OR COUNT(IF [View Set] THEN [View] END) = 0
- Navigate to the "Map" worksheet
- Drag [Is Map?] to the Filters shelf
- In the Filter dialog, do the following and click OK:
- Select Custom value List
- In the yellow bar, type in "True" without quotes
- Click the + symbol
- Repeat steps 6-10 for every worksheet that should be included in the sheet selector
- Drag the "Source Sheet" worksheet onto the dashboard where the worksheets to be shown/hidden are placed in one layout container
- Navigate to Dashboard > Actions...
- In the Actions dialog, click Add Action > Change Set Values...
- In the Add Set Action dialog, do the following and click OK:
- For Source Sheets, check only "Source Sheet"
- For Run action on, choose Select
- For Target Set, in the first dropdown select the data connection created in step 1
- For Target Set, in the second dropdown select View Set
- For Clearing the selection will, select Remove all values from set
Additional InformationThe set [View Set] returns either TRUE or FALSE for every row, therefore the IF statement in [Is Map?] converts the Boolean value into the actual [View] value. If that actual [View] value is "Map", then the condition is TRUE. The first condition will return a TRUE or FALSE value for every value of [View], but we only care if at least one of the values is "Map", thus the MAX() aggregation will return TRUE if any of the returned values are TRUE.
The second condition in [Is Map?] is an optional addition that is TRUE when no values are selected in the set. This is a way to make the map the default view shown before the user selects any worksheets.
Discuss this article...
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Training and Tutorials