Tableau Groupings Pt.2: Rep Your Set (Sets and Dynamic Groupings)

Kevin Macias-Matsuura
6 min readNov 12, 2020

Welcome to part 2 and entry number 5 in my Tableau tutorials series. In my two part series we are looking at how to group your data. There are countless scenarios where one would want to use groupings of some sort, but you can think of groupings as a way to get a more detailed view of some subset of your data. For example, if we are using a COVID-19 dataset we may want to see only cases that include people from the ages of 50 to 60. There are a few ways we could go about viewing that particular group. What if we want to see people from the ages of 50 to 60 that live in California. There’s ways we can do that as well although we may need to use different grouping methods. In part one this blog we covered groups, hierarchies, and ordering which are ways to group data. In this entry we will be looking at sets and dynamic groupings using calculations and parameters.

Tableau sets are broken down into two groups: Constant and Dynamic. Just like the names suggest, constant sets stay the same while dynamic sets change with the data. In a basic sense we create constant sets with the view and dynamic sets with a calculation (shameless plug: check out my blog [LINK] on calculations if you want more detail on how to use calculations. If you’ve read through some of my previous blogs tackling Tableau you might be wondering how sets are any different than a filter or group. In Tableau’s own training videos they even mention that sets function much like filters. Although you can use dynamic sets and filters in much the same way, sets are not strictly relegated to the current worksheet you are working with. Sets can be moved and reused to see how a subset of your data performs in different scenarios. Groups on the other hand can be thought of as a simple set. Where groups deal with one dimension sets can take in multiple dimensions and, just like in set theory, show results that belong to both sets or remove results that fall in both sets. With this basic understanding of what sets are we can jump into some examples.

To illustrate how to use sets I will be using the same e-commerce dataset I used in the first part of this blog. I created a graph to show the daily sales for October and November which showed me that there was a big spike in sales on the 15th, 16th, and 17th day of the month in October. If we wanted to know what was being sold on that day we can use a constant set. To create the set we simply left-click and drag the mouse over the values we want to include (or you could command+click and select the values one-by-one). From there the menu will appear where we can then click on the icon that looks like a Venn diagram with two circles. If you are familiar with set or logic theory, or remember those circles from grade school, this symbol should look familiar.

From the set icon we then click “Create Set…” and name our set. We can skip the creativity and name this set “Top Sales Days Oct”. If we have a lot of data and find it easier to select what we don’t want, we can click the “Exclude” checkbox from the popup window. In the window we should also be able to see the field and values we selected. When we’re ready we can hit “OK” and see our set with the same icon as a pill in our Tables section to the left of our screen. Now that we have a set with those top sales days we can then move to another worksheet. In my sales by item worksheet we can drag the set to “Color” and see the highlighted items in blue that were purchased on that day.

As mentioned previously, groups are static and if we remove them the data reverts back to it’s original display. One way we can get the visualization to change with the data is to use calculations and parameters. Let’s look at a graph of the top brands by number of units sold.

If I wanted to see which brands fall above 300k units sold I can start by setting a parameter that we can then change in real time. If we right click in the data pane then select “Create Parameter …” it will take us to a popup window where we’ll name our parameter “Limit”. For this example we can leave the default parameters except for “Current value” which we can set the default as 300,000.

For reference, if we have other parameters that we already created they will appear under “Value when workbook opens” where we can choose what is displayed when we open the workbook. “Display format” lets us display values in other formats, for example, date can look like 10/23/2020 or 10/23/20. Allowable values lets us choose how we can manipulate the parameter. Maybe you want a list of values to choose from that will shift the display or maybe you want to limit the user to an allowable range of values. For our case the default is a simple text field where we can freely dictate what value we want to display. Now that we have our limit parameter we can create a calculation that incorporates our parameter. To do that we right-click again in the data pane and select “Create Calculated Field…”. From the window we can name the calculation “Unit Sales” and either write out our calculation or, to make our lives easier, we can also drag in the parameter and table fields to help fill in our calculation. For our case the formula would be “IF COUNT([Brand]) > [Limit] THEN ‘> Limit’ ELSE ‘< Limit’ END”.

Now we can drag the calculation to “Color”. Then from our parameter that we created we access the pill’s dropdown menu and click “Show Parameter”. If we look to the right of the screen we should see color labels for our calculation and a text field where we can adjust the limit and watch the graph adjust in real time.

For a last quick tip we can also form groups with bins. You can think of bins like recycling bins. Each bin contains values that fall within its rules like how you would separate metals, glass, and plastics excepts we separate numerically. This is useful if we want to see how many units are selling within some general pricing ranges. Let’s break up our prices into bins of $100. All we need to do is right-click on a numeric field then go to “Create” then “Bins…”. We change the name to “$100 bins” then enter 100 into “Size of bins”, hit enter then drag our newly created field from the data pane into the columns section and fill in rows with the count of unit prices. Now we can see how many units were sold in increments of $100.

I hope this and the other entries in my Tackling Tableau Venture have been helpful in getting you started using this great software. I’m going to be taking a break writing about tableau for a bit to tackle some other topics. Please follow my Medium profile to as I will be posting other data related topics soon!

--

--

Kevin Macias-Matsuura

Former English teacher turned Data Scientist/Analyst interested in data, design, and storytelling.