Add Options to a Filter Using Set Actions in Tableau

Data

Add Options to a Filter Using Set Actions in Tableau

“I’ve filtered my countries to show me my top 10 by sales. However, I still want to see the information for England in the table and maybe Italy as well. Is there any way I can force these two to show up, as well as the top 10? What if I want to let the user choose which countries they want to add?”

Why, yes, there is a way!

Your first thought might be to use a parameter. While parameters would let us choose a specific value to compare, we would unfortunately be limited to only one since multi-select parameters are, at this point, not a thing. The newly introduced set actions can act as a substitute in this specific case, though!

Let’s draw out what we want to do before we get started:

venn diagram for set actions

We want to be able to see our top 10 countries, as well as any countries we specify. These may overlap (ex: I really want to see the United States, so I specify that, but it’s also in the Top 10), or they may be distinct, but we want to be able to see everything in either group. Thinking of it this way led me to realize that sets are a great way to go.

Why?

  • Sets can be set to conditional or Top 10 to allow us to create the first group.
  • Sets can have multiple inputs, and we can allow our users to choose what goes into a set on the dashboard, allowing us to create our second set.
  • Sets can be combined to meet the criteria we specified above.

Step 1: Create Your “Top 10” Set

First things first—we need to create a way set for our Top 10, so we can begin to create our Venn diagram above.

  • Right-click on the dimension you’re going to create the set on (Country in our case).
  • Click on Create then Set:

creating a set in Tableau

  • Name it Top 10 [Dimension] by [Measure] which, in this instance, is Top 10 Countries by Sales.
  • Select the Top tab and make it By field:

creating a set in Tableau

Step 2: Create Your “Specific Countries We Want to See” Set

We need to create a set that will include the Countries we want to add to our list. This is the second circle in our Venn diagram.

  • Right-click on the dimension you’re going to create the set on (Country in our case).
  • Click on Create then Set.
  • Name it [Dimension] to Add (ex: Countries to Add).
  • Leave it on Select from list, and make sure none is selected.
    • If you’re uncertain and there are a lot to check, click on None to make sure:

creating a set in Tableau

Step 3: Combine These Two Sets

This will be our combined list of the Top 10 Countries, as well as any Countries we want to see in our list. In other words, it’s our two circles together, so the entire Venn diagram!

  • Select both of the sets by holding Ctrl and clicking on both.
  • Right-click on either of the sets. It doesn’t matter which one!
  • Select Create Combined Set

create a combined set in Tableau

  • Name it [Dimension] to View (ex: Countries to View).
  • Make sure that All members in both sets is selected:

create a combined set in Tableau

Step 4: Filter to See the Combined Set

We want to only see the Countries that fall into our new combined set, so we need to filter by that set.

  • Drag the Countries to View to your Filters card:

filter to see the combined set in Tableau

Step 5: Create a Way to Select Extra Countries

We’re most of the way there! However, we now need the option to select which Countries we want to add to the list. In order to do that, let’s create a list of all the Countries:

  • Create a new sheet.
  • Add [Dimension] to the Rows.
  • Change the mark from Automatic to Shapes.
  • Bring the [Dimension] to Add set to the Shape box in the Marks card—we’ll come back to this later.

Step 6: Put All of This Together in a Dashboard

  • Bring both of these sheets onto your dashboard:

combine sheets into Tableau dashboard

Step 7: Create a Set Action

We now need to tell Tableau that we want our list of Countries to Add to control our Countries to Add set.

  • Select Dashboard from your toolbar at the top and then Actions:

creating a set action in Tableau

  • Add a Change Set Values action:

adding a change set values action in Tableau

  • The Source Sheet should be your Countries to Add sheet, and you should Run Action on Select.
  • The next two options are to select the data source and the set, which is the Countries to Add set from the Superstore Sales Training data source.
  • Make sure that clearing the selection will Remove all values from the set. This will leave the Top 10 Countries in the filter even when no Country to add has been selected:

creating a set action in Tableau

Step 8: Select a Few Countries to Add to Your List

The shapes from Step 5 will now come into play!

  • Hold Ctrl and select two or more Countries on the Countries to Add list, making sure to select the circles.
  • Navigate to the sheet with your list of Country names.
  • Click on the Shapes button on the Marks card.
  • Set the shapes for In and Out to whatever you want, keeping in mind that In means it was selected to add. I’ve set mine so that In is a checkmark, and Out is a plus symbol:

set shapes for In and Out in Tableau

That’s it! You’ve done it! Now go back to your dashboard and play around, noting how selecting one of the countries adds it to the table (if it was not already in the Top 10).

Thank you, Tableau, for introducing set actions to my life.

More About the Author

Rachel Kurtz

Analytics Consultant
Celebrating the Women of InterWorks As you may have heard, InterWorks’ best asset is by far our people. It’s the thing I’m thankful for day in and day out and one of the ...
Visualizing Geographic Data with Set Actions in Tableau Note: This blog post builds on a previous post and was created in collaboration with analytics consultant Dave Sirey.  Set actions are ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072