Tableau Toggle Switches

Have you ever wanted to create a toggle switch in Tableau, but thought you needed to add in an extra data source - excel spreadsheet? You can actually create one using Parameter Actions and just using your current data set.

Follow the steps below to create a toggle using parameter actions.

Step 1. Create a Parameter called “Toggle”

Tableau Toggle Parameter

Step 2. Create a calculated field, called “Toggle ON and OFF”

Tableau Toggle Calculated Field

Step 3. Create a new sheet, and call it “Toggle Sheet” and add the shapes you’re going to use to your Shapes folder. For simplicity, let’s just use Tableau’s out-of-the-box shapes. I’m going to use arrows for this demo.

  1. In the Marks card of your “Toggle Sheet”, choose Shape.

  2. Drag the calculated field “Toggle ON and OFF” to the Marks Card onto shapes.

  3. Change fit, up at the top of the screen, to “Entire View”


**Toggle deep dive:

Right-click the “Toggle” parameter and click “Show Parameter”; **Note: the parameter shows “True”, but the value of the calculated field “Toggle ON and OFF” is “False”; this is correct.

Toggle = True; Toggle ON and OFF = False

Toggle = False; Toggle ON and OFF = True

Note: The calculated field (“Toggle ON and OFF”) default is “False” (which is the resting state); think of it like this, “when the “Toggle ON and OFF” hasn’t been activated (False), the shape is set to “x”, and when the “Toggle ON and OFF” has been pushed (True), the shape is set to “y”


Step 4. Choose True in the “Toggle” parameter, and add shapes

Click on Shape in the Marks card and select “Arrows” from “Select Shape Palette:” drop-down menu, select False on the left side, underneath where it says “Select Data Item:” and then click the Right arrow, like this: (then select Apply and OK)

Step 5. Choose “False” in your “Toggle” parameter, like this:

Step 6. After choosing “False” in the toggle parameter, now we’re going to add a shape

Click on Shape in the Marks card and select “Arrows” from “Select Shape Palette:” drop-down menu, select True on the left side, underneath where it says “Select Data Item:” and then click the Left arrow, like this: (then select Apply and OK)

Step 7. Create a parameter action; let’s create the parameter action on the sheet first so you can see the toggle working

  1. On your sheet, go up to the top menu and select Worksheet

  2. Then select “Actions…”

Tableau Worksheet Parameter Actions

Step 8. Select “Change Parameter…” from the Actions menu

Step 9. Create the Parameter Action, like shown:

  1. Name the Parameter Action “Toggle Switch ON and OFF”

  2. Target Parameter = Toggle

  3. Source Field = Toggle ON and OFF

**Note: Keep the default selections for the rest of the options

Tableau Toggle Selections

Click OK on this window, and click OK on the Actions window.

If you click the toggle button on your sheet over and over, you will see that the toggle button changes the parameter selection, but we need to remove the extra clicks and highlights.

Also, the toggle won’t do us much good at this point; we will now set up the toggle to trigger some actions in our dashboard.

Previous
Previous

Tableau Toggle - Remove Highlight

Next
Next

Blog Post Title Three