KNOWLEDGE BASE

How To Create Buttons To Swap Sheets


Published: 29 Sep 2020
Last Modified Date: 10 Dec 2020

Question

How to create buttons to swap sheets. Example: Buttons for swapping sheets between profit and sales

Environment

Tableau Desktop

Answer

CLICK TO EXPAND SOLUTION

Buttons for swapping sheets between Sales and Product Details

  1. Create calculated fields with Strings for buttons. Example: Sales Button : "Sales" and Product Button: "Product"
  2. Create two placeholder calculated fields as discrete and dimension as following: zero: 0 and One: 1
  3. On an new sheet named Sales Button drag Sales Button, zero and one to Details on Marks Card
  4. On an new sheet named Product Button drag Product Button, zero and one to Details on Marks Card
  5. (Optional) Create the Sales and Product sheets as desired (in our example, these sheets are named Sales by Segment, and ProductDetails)
  6. Add the Sales Button and Product Button to your dashboard
  7. Add a Horizontal/Vertical Layout container. Add Sales by Segment, and ProductDetails sheet to this Layout container until a dark blue thick line appears
  8. Hide the Titles of Sales by Segment, and ProductDetails sheet
  9. Configure four actions as below:
    1. Action Filter 1 for Sales: 
      1. Select the Sales Button Source Sheet as the Source
      2. Choose Select to run the action
      3. Select the ProductDetails sheet as a Target Sheet
      4. Choose Exclude all values when Clearing the action
      5. Add a Target Filter using; One as the Source field and Zero as the Target Field
    2. Action Filter 2 for Sales: 
      1. Select the Sales Button Source Sheet as the Source
      2. Choose Select to run the action
      3. Select the Sales by Segment sheet as a Target Sheet
      4. Choose Leave the filter when Clearing the action
      5. Add two Target Filters using;
        1. One as the Source field and Zero as the Target Field
        2. And Zero as the Source field and One as the Target Field
    3. Action Filter 1 for Products: 
      1. Select the Product Button Source Sheet as the Source
      2. Choose Select to run the action
      3. Select the Sales by Segment sheet as a Target Sheet
      4. Choose Exclude all values when Clearing the action
      5. Add a Target Filter using; Zero as the Source field and One as the Target Field
    4. Action Filter 2 for Products: 
      1. Select the Product Button Source Sheet as the Source
      2. Choose Select to run the action
      3. Select the ProductDetails sheet as a Target Sheet
      4. Choose Leave the filter when Clearing the action
      5. Add two Target Filters using;
        1. One as the Source field and Zero as the Target Field
        2. And Zero as the Source field and One as the Target Field
  10. Clicking on the button will get the respective sheet in the bottom view
To view the steps showed in the below video, please expand the above section. Note: the video has no sound.
 
Did this article resolve the issue?