How to create a Toggle Switch with Parameters?

by Robin von Malottki

Was ist ein Toggle Switch?

(Gif by Author)

With a toggle switch you can switch between two measures via a button.


How to create a toggle switch in Tableau?

1. Create a parameter

(Image by Author)

2. Create a calculated field - Toggle Button

(Image by Author)

3. Create a calculated field - Toggle Measures

(Image by Author)

4. Create the toggle button

i) Open a blank worksheet.

ii) Select "shape" in the Marks card.

iii) Drag the created field from step 2, "Toggle Button", onto Shapes.

iv) Click on "shapes" in the Marks Card and set your toggle button.

(Image by Author)

v) Show the parameter

vi) Change the setting of the parameter (True to false)

vii) Click Shape again in the Marks Card and add your second icon

5.      open a new worksheet and create a visualization with the field created in step 3, "Toggle Measures".

6.      Open a new dashboard and add both worksheets, from step 4 and step 5, to the dashboard.

7.      Open the dashboard action menu with CTRL + Shift + D and create a parameter action via "Change Parameter".

(Image by Author)

At the "Source Sheets" you have to select the sheet where you created the toggle buttons. At "Target Parameter" you take the parameter created in step 1. At "Source Field" enter the button you created in step 2. Click on Okay. Your toggle button is ready!