Use Icons to Add and Remove Values from a Set

The What

Set actions allow the user to choose what is included and excluded from a set. Through the use of icons/shapes, the user can select what values they want to see as part of the set. Note: this method requires a worksheet (for the icon), a set, and a set action for every value (east, west, central, & south in this example), so it will work best when there are a limited amount of never changing values.

Click to view on Tableau Public

The Inspiration

This exchange on twitter from Ken Flerlage made me curious if I could figure out a way to make selecting multiple items easier than having to hold down a button.

The How

  1. Determine which dimension to use. In this example I am going to choose region. Therefore, I will allow the user to toggle between choosing if the region values of east, west, south, and central should be included or excluded from the set.
  2. Create a new set, one for every value of the selected dimension. In this example, I will create four new sets (one for east, west, south, and central).To do this, right click on region from the dimensions pane and select create > set. Name the set [Value Name] Set and do not change any of the other settings.

    Upon completion, you should have four new sets:
  3. Create a new worksheet, one for every value of the selected dimension. This will serve as the icon used by the end user to add/remove values from the set. The easiest route is to setup the worksheet for one value and then duplicate it (and swap out the correct values) for the others. To create the needed worksheet for the east region:
    1. Create a new worksheet called “East Icon”
    2. Add “Region” to the filters shelf. Select “East”
    3. Add “Region” to the rows shelf
    4. Change the mark from automatic to shape
    5. Add the “East Set” created in the previous step to the shape mark
    6. Duplicate the “East Icon” worksheet three times, once for south, central, and west. Then update the filter to the correct region and place the correct set on the shapes mark.
  4. Create a new dashboard. Add the four icon worksheets into a vertical container (if desired). Remove the title, hide field labels for rows (the word “region”), and fit to the entire view. Keep the legends for now (but will delete later!).
  5. Add four new set actions, one for every value.This can be done by going to dashboard > actions > add action > change set values. Name the set [Value] Set Action. Run action on select of the corresponding icon worksheet. Change the target set to the datasource, as well as the corresponding set. Clearing the selection will remove all values from the set.

    You should end up with four new set actions:
  6. Test it out! Click on any of the icons on the dashboard. The icon shape should update, as well as the legend.
  7. Update the “In” shape of each set to be something more meaningful, such as a checkmark. Leave the “out” shape as a circle or update to your preference. Then delete the legends from the dashboard.
  8. Now it’s time to write a calculation that will allow us to know what is “In” and what is “Out”. This calculation can then be used as a filter, on the colors shelf, rows shelf or anywhere else! Create a new calculated field called “In/Out”. This field will return “True” when a value is selected and “False” when it is not selected.
    [East Set] OR [West Set] OR [South Set] OR [Central Set]
  9. Create a new worksheet. Add “Region” to the rows shelf, “Sales” to the columns shelf, and “In/Out” to the color mark.
  10. Add this worksheet to the dashboard and test it out!
  11. That’s it! Clean up the formatting, add labels/instructions, and any additional worksheets that make use of the “In/Out” calculation

To view my working example on Tableau Public or to download my workbook, click here. Also, check out the other dashboards in the workbook detailing different ways use set actions. To view this method applied to NBA data, click here.