KNOWLEDGE BASE

How to Change Filter Conditions of the Destination Worksheet Depending on the Source Worksheet When Using Go to Sheet Action


Published: 02 Dec 2022
Last Modified Date: 05 Dec 2022

Question

Can I change filter conditions of the destination worksheet depending on the source worksheet?

Environment

  • Tableau Desktop

Answer

The following is an example of a transition from a line chart and a bar chart to a cross-tab, with filtering on different dimensions

From Line chart to Cross-tab : Filter by Category.
From Bar chart to Cross-tab : Filter by Year and Month.
User-added image

1. Create a calculated field and name it Source Sheet (Line chart).
"Line chart"
2. Create a calculated field and name it Source Sheet (Bar chart).
“Bar chart"
3. Create a String parameter and name it Source Sheet Name.
4. Create a String parameter and name it Category.
5. Create an Integer parameter and name it Year and Month.
6. Open Line chart worksheet and add Source Sheet (Line chart) field to Detail.
7. Open Bar chart worksheet and add Source Sheet (Bar chart) field to Detail.
8. Select Menu > Worksheet > Actions. Click Add Action and select Change Parameter.
   Create parameter actions as follows:
 User-added image
 User-added image
 User-added image
 User-added image
9. Click Add Action and select Go to Sheet
   Create Go to Sheet actions as follows:
 User-added image
 User-added image
10. Create a calculated field and name it Filter.
IF [Source Sheet Name]="Line chart" 
    THEN [Category]=[Parameters].[Category]
ELSEIF [Source Sheet Name]="Bar chart" 
    THEN (DATEPART('year', [Order Date])*100 + DATEPART('month', [Order Date]))=[Year and Month]
END
11. Open Cross-tab worksheet and add Filter field to Filters shelf and select TRUE.
Did this article resolve the issue?