Using Groups and Sets in Tableau
This post is going to describe what a group and a set is in Tableau and how to use them in your visualization.
What is a Group in Tableau?
A Group, as the name suggests, is a combination of more than one element of a dimension/measure. Once you combine multiple elements of a dimension to form a group, the meta data changes and all the elements of the group are treated as a single entity.
Lets understand this with an example:
Suppose I have data for multiple startups, no of employees working in those startups and an industry to which each startup belongs to. Now, if I want to analyze the average no. of people working in different industries, I will drag the industry dimensions to rows and Employees measure columns and aggregate it to average.
What if there are too many industries? I could combine similar kind of industries. This could be done by making groups of similar kind of industries and treating multiple industries in a group as a single entity and then taking average of Employee strength for each group.
Fig 1: All industries with average no of employees
Fig 2: Industry groups with average no of employees
If you observe the above two figures carefully, I have combined 'Computer Hardware', 'IT Services' and 'Software' into a single group called 'IT Multiple'. Now IT Multiple is acting like a single industry.
But, by taking the average of our combined industry group, aren't we taking average of the average number of employees in each industry? Is this really solving our problem?
Yes. As you know, Tableau is an intelligent program. When we take the average of a group, instead of calculating the average of the average (or aggregate of the aggregate) of individual components, which is not a good practice, it actually calculates the average of all the components combined, i.e., it treats all the components of a group as a single entity! And that is what we wanted to do.
What is a Set in Tableau?
Sets are not groups, both of them have different use cases. In a group all the individual items are merged together. In a set they aren't.
A set is a stacked form of some elements having a similar characteristics.
Sets do not change the meta data. All the elements still remain individual entities. They are not merged. Its just a way to see them in a group together.
What is the use case of a set?
A set is useful in cases when you frequently have to highlight/filter (or do any action) on some particular elements together. Selecting them individually from a larger list every time you need to apply an action could be a very tedious task.
This problem could be solved by creating a set of those elements together and then dragging the set to the marks/filter card.
In the following example, all I have done is made a set of four industries: 'Software', 'Telecommunications', 'IT Services' and 'Computer Hardware'. After this, just by dragging the set to the colors section of marks card, I have been able to highlight the required industries. It saves so much of repetitive manual work, provided you are going to use them frequently.
Fig 3: Using a in marks card
I hope this clearly demonstrates the difference between a group and a set in Tableau and how/where to use them.