Another key ability of any data analyst is to be able to effectively segment data by creating Tableau sets.
We’ve touched on various components of how to take your analyses and insights skills to a higher level, including sorting and filtering data, to being able to see more details, or using more insightful charts and Quick Table Calculations, like percents of total and percent differences.
Segmentation through Tableau sets can be used to answer the following types of questions:
- Who are our customers?
- What do they buy?
- What are their needs?
- Where can we find these people? (based on location, actions, social activity, etc.)
- What kinds of messaging, communication and advertising will resonate with these groups?
- What are common patterns in behavior?
- Where or from whom can I find similar products?
By dragging any Dimension onto Rows or Columns, we are creating a segment, such as Region or Marketing Channel. But we can become more analytically sophisticated in our segments through the use of Dynamic Sets and Clustering.
Tableau Dynamic Sets
Sets can either be static or dynamic. Static Tableau sets are manual groups you create. For example, you could create a set called Continental USA and include all contiguous 48 states, excluding Alaska and Hawaii. Or you could lasso a group of products and group them by right clicking and choosing Create Set. These are just slightly more advanced than normal Groups, which we discussed much earlier in the book. Let’s not spend any more time there.
Tableau Top N Sets
We want to explore Dynamic Tableau Sets, which recalculate based on updates to the data. As an example, let’s create a set called Most Returned Products, which will update with whatever products get returned the most.
- To start, you need to right click on the Dimension you want to create a set for. In this case, right click on Product Sub-Category, and then choose Create > Set.
- A dialog box will appear with options: General, Condition, Top. Choose Top.
- Click the By Field button. Change the number to 5.
- From the drop down menu below that, choose Order ID (Returns).
- Set the Tableau aggregation to the right of that to Count.
- Rename this Tableau Set to Most Returned Products. Click ok.
- The newly created Tableau Set will now appear in the bottom left corner.
- Now we’ll use this Tableau set in a viz. Open a new worksheet. Drag your Tableau set out to Rows. It will look like this image. We have the option to use the Tableau set in two ways, either showing those items within and out of the Tableau set, or to show just the members in the Tableau set.
- For now, drag out Product Sub-Category to the right of your Tableau set on the Rows shelf.
- Now, right click on Order ID (Returns) and drag that to Columns (while still holding down the right click key).
- A dialog box will appear, overriding Tableau’s defaults. Choose CNT for count.
- This will create a bar chart that clearly shows its brought the most returned items into the “In” group and placed everything else in the “Out” group.
- Now, click the drop down arrow on the In/Out Tableau set pill and choose “Show members in set.” Remove Product Sub-Category from the Rows shelf.
- Click the Sort Desc icon and we get the following viz:
The great thing about this is it’s a calculation, meaning what is “In” the Tableau set is dynamic based on the underlying values. If the store introduces a line of computer mice that don’t work, they’ll all likely get returned and we’ll see that product appear on the list.
Tableau Conditional Sets
We can also create a condition that puts items into the Tableau Sets if they are above or below a certain threshold, say Profit below $0. The previous Tableau Sets we created was a Top 5. Using a condition grabs anything that meets the criteria your Tableau sets.
- Let’s create a new Tableau Set. Right click on Product Sub-Category again and choose Create > Set.
- Click on the Condition tab.
- Choose the button By Field.
- Set that drop down to Profit and the aggregation to Sum. Set it to <= from the drop down and then type in “0” in the box.
- Rename this Tableau set to Unprofitable products. Click ok.
- Your Tableau set will appear at the bottom left like the previous one we created.
- Create a new worksheet and title it Unprofitable Product Tableau Set.
- Drag Product Sub-Category to Rows. Drag Sales to Columns.
- Sort Desc.
- Drag your newly created Tableau Set to Color.
- Click the drop down arrow on your color legend to change the color and choose orange for those that are “In” the Tableau Set. We can now quickly see that Tables are the 2nd highest selling item yet are unprofitable. We can quickly take action on this. Once we correct our unprofitable ways, Tables will drop out of the Tableau Set.
Tableau Combined Sets
Lastly, we can create a combined Tableau set, which outputs the results from the interaction of 2 Tableau sets, for an even more specific, yet still dynamic, grouping.
- Right click on one of your Tableau sets at the bottom left. Choose Create Combined Set.
- Name this Tableau Set, “Most Returned, Unprofitable Products.”
- Ensure one Tableau set has been selected from each of the drop down menus.
- There are a variety of options we can choose from, but in our case we want “Shared Members in Both Sets.” Choose ok.
- Create a new worksheet. Drag your newest combined Tableau Set out to Rows.
- Drag Product Sub-Category to the right on the Rows shelf.
- Right click and drag Order ID (Returns) to Columns. Set it to Count. Notice how there is no “In” set; it’s all Out.
- Right click on your Most Returned Products Tableau Set at the bottom left and choose Edit Set.
- Click the Top tab and change it from 5 to 20. Notice how the viz changes.
- Now, drag Profit to Color.
- Sort Desc.
- Title the worksheet “Number of Returns per Product vs. Profit per Product.”
- Include an annotation by right clicking Annotate > Area.
- Type in: “Number of returns doesn’t necessarily cause unprofitability. Some of our most returned products are also our most profitable. What’s different about the unprofitable items that get returned vs. the profitable ones?”
- Finally, right click on the In/Out labels on your chart. Choose Edit Alias.
- For “In,” change that to “Unprofitable and Highly Returned Items.”
- For “Out,” change that to “Profitable, yet Highly Returned Items.”
We could tie those three separate charts into a dashboard, with a little additional formatting, like so:
Practice Exercises
The VP of Sales wants to know the products that are purchased the most compared to products that are unprofitable. She doesn’t want to incentivize her sales team to hit sales targets that end up not being profitable for the company. She asks you to help her have that insight available at her fingertips, no manual analysis on her part required nor time to wait for it to get updated by an analyst somewhere, and it needs to be dynamic.
- Right click on Product Sub-Category, Create>Set.
- Choose the Top tab.
- Set By Field to Top. Then, in the next box to the right, click the drop down, and choose Create a new parameter.
- Title that parameter Top N.
- Ensure the data type is set to Integer and the Allowable Values are set to Range.
- Set the Maximum to 10 and click Ok.
- Then, back in the Tableau Sets editor, choose Order ID from the large drop down menu and ensure the aggregation next to it is set to Count.
- Title this Tableau Set “Most Ordered Products”.
- Drag this Tableau Set onto a new worksheet on Rows. Then, drag Product Sub-Category to the right of that pill, also on Rows.
- Right click on Order ID and drag it to columns. Set the aggregation to Count when the aggregation window pops up.
- It should be clear what the most ordered products are, and you can determine how many products make it into those groupings by adjusting your Top N parameter, which should automatically appear up at the top right. If it doesn’t, go down to the Parameters section at the bottom left, right click on it and Show Parameter Control.
- Now, create another Tableau set again on Product Sub-Category (right click the dimension and go from there).
- This time, go to the Condition tab.
- Set the By field to Profit, the aggregation to Sum, and then set it to < 0.
- Name this Tableau Set “Unprofitable Product Lines”.
- Drag this on Rows in between the 2 pills that are already there.
- Rename this viz to “Most Ordered, Profitable vs. Unprofitable Products”.
- Set your Top N filter to 10, and ensure that the Profitable set appears before the Unprofitable ones. If they aren’t in that order, click on the Unprofitable label in the viz and drag it down.
- Change the labels on your first Tableau sets to be more descriptive than In/Out. Right click on the one that says “In” and Edit Alias to “Most Ordered”. Change “Out” to be “Less Popular”.
- Drag this most recent Tableau set also to the Color shelf.
- Save the workbook (probably a good time to do that!)
Learning how to create Tableau sets will make you better in obtaining actionable insights. When it comes to getting insights from data, we offer an in-depth in-person class you can take, as well as online Tableau courses. Check out our Tableau training here.