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: 

  1. Who are our customers? 
  2. What do they buy? 
  3. What are their needs? 
  4. Where can we find these people? (based on location, actions, social activity, etc.) 
  5. What kinds of messaging, communication and advertising will resonate with these groups? 
  6. What are common patterns in behavior? 
  7. 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. 

  1. 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. 
  1. A dialog box will appear with options: General, Condition, Top.  Choose Top. 
Tableau Sets
  1. Click the By Field button.  Change the number to 5.  
  1. From the drop down menu below that, choose Order ID (Returns). 
  1. Set the Tableau aggregation to the right of that to Count. 
  1. Rename this Tableau Set to Most Returned Products.  Click ok.  
    • The newly created Tableau Set will now appear in the bottom left corner. 
  1. 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. 
Sets in Tableau
  1. For now, drag out Product Sub-Category to the right of your Tableau set on the Rows shelf. 
  1. Now, right click on Order ID (Returns) and drag that to Columns (while still holding down the right click key). 
  1. A dialog box will appear, overriding Tableau’s defaults.  Choose CNT for count. 
Create Sets in Tableau
  1. 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. 
  1. 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. 
  1. Click the Sort Desc icon and we get the following viz: 
Tableau Dynamic Sets

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. 

  1. Let’s create a new Tableau Set.  Right click on Product Sub-Category again and choose Create > Set. 
  1. Click on the Condition tab. 
  1. Choose the button By Field. 
  1. 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. 
  1. Rename this Tableau set to Unprofitable products.  Click ok.   
  1. Your Tableau set will appear at the bottom left like the previous one we created. 
  1. Create a new worksheet and title it Unprofitable Product Tableau Set. 
  1. Drag Product Sub-Category to Rows.  Drag Sales to Columns. 
  1. Sort Desc. 
  1. Drag your newly created Tableau Set to Color. 
  1. 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 Conditional Sets

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. 

  1. Right click on one of your Tableau sets at the bottom left.  Choose Create Combined Set. 
  1. Name this Tableau Set, “Most Returned, Unprofitable Products.” 
  1. Ensure one Tableau set has been selected from each of the drop down menus. 
  1. There are a variety of options we can choose from, but in our case we want “Shared Members in Both Sets.”  Choose ok. 
Tableau Combined Sets
  1. Create a new worksheet.  Drag your newest combined Tableau Set out to Rows. 
  1. Drag Product Sub-Category to the right on the Rows shelf. 
  1. Right click and drag Order ID (Returns) to Columns.  Set it to Count.  Notice how there is no “In” set; it’s all Out. 
  1.  Right click on your Most Returned Products Tableau Set at the bottom left and choose Edit Set. 
  1. Click the Top tab and change it from 5 to 20.  Notice how the viz changes. 
  1. Now, drag Profit to Color. 
  1. Sort Desc. 
  1. Title the worksheet “Number of Returns per Product vs. Profit per Product.” 
  1. Include an annotation by right clicking Annotate > Area.  
  1. 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?” 
  1. Finally, right click on the In/Out labels on your chart.  Choose Edit Alias. 
  1. For “In,” change that to “Unprofitable and Highly Returned Items.” 
  1. For “Out,” change that to “Profitable, yet Highly Returned Items.” 
How to Create Combined Sets in Tableau

We could tie those three separate charts into a dashboard, with a little additional formatting, like so: 

What are Sets in Tableau

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. 

  1. Right click on Product Sub-Category, Create>Set. 
  2. Choose the Top tab. 
  3. Set By Field to Top. Then, in the next box to the right, click the drop down, and choose Create a new parameter
  4. Title that parameter Top N. 
  5. Ensure the data type is set to Integer and the Allowable Values are set to Range. 
  6. Set the Maximum to 10 and click Ok. 
  7. 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. 
  8. Title this Tableau Set “Most Ordered Products”. 
  9. Drag this Tableau Set onto a new worksheet on Rows. Then, drag Product Sub-Category to the right of that pill, also on Rows. 
  10. Right click on Order ID and drag it to columns.  Set the aggregation to Count when the aggregation window pops up. 
  11. 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. 
  12. Now, create another Tableau set again on Product Sub-Category (right click the dimension and go from there). 
  13. This time, go to the Condition tab. 
  14. Set the By field to Profit, the aggregation to Sum, and then set it to < 0. 
  15. Name this Tableau Set “Unprofitable Product Lines”. 
  16. Drag this on Rows in between the 2 pills that are already there. 
  17. Rename this viz to “Most Ordered, Profitable vs. Unprofitable Products”. 
  18. 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. 
  19. 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”. 
  20. Drag this most recent Tableau set also to the Color shelf. 
  21. 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.