Tableau developers can quickly and easily group data together to place it into categories without having to manually update the incoming source data. Grouping is quick and easy. We’ll explain a few different methods for creating groups that will help you develop dashboards and reports faster than ever.
Groups in Tableau are used to categorize and organize dimension members. They enable you to group similar data points together, making it easier to create meaningful visualizations and gain insights. They can be setup manually or dynamically with formulas, we’ll explore both methods.
Let’s dive in!
Table of Contents
What is Grouping in Tableau?
Grouping is a method in Tableau that lets you classify, categorize, and organize data. By creating groups, you can place data into higher level buckets than what is available in your dataset making it easier for report viewers to see high level categories, but maintain the ability to drill down into them if they want to see line item detail in other parts of your Tableau dashboard.
Some common examples of grouping include:
- Customer Segmentation
- Product Categorization
- Sales Regions and Sales Person assignments
- Content Cohorts
Of course there are many other reasons you would want to create custom groups for your data, but generally it’s to provide a higher level view of what is available at the row level while maintaining row level detail.
Now let’s take a look at how to group in Tableau.
How to create Custom Groups in Tableau
To group data in Tableau, select the column of data that you want to create groups for. Right click and select “Create Group”. This launches the Tableau group editor. Select, or multi-select items in the group list and click the Group button at the bottom of the group editor. The selected items will be moved into a new group.
We’ll break it down in more detail using the following dataset that’s been imported into Tableau. We’re going to assign cities to West and East sales regions.
When we create groups, we like to do so from the Data Source tab, as it provides a preview of the data being used to create groups and will ultimately show us a new column for the applicable group assignments. This helps us ensure that we’ve assigned everything a group and that results are as intended.
It’s also possible to right click on a column and create a group from the data panel when building a sheet or visual.
Manually Creating Groups in Tableau
There are a couple of different ways to group data in Tableau, the fastest and easiest way is to use the group editor. It provides a graphical interface that lets you drag and drop or select values to assign to groups. Here’s how to use it.
Step 1.) Launch the Tableau Group Editor
From the data source tab of Tableau, right click on a column header that you wish to group and select “Create Group” to launch the Create Group editor. The column that you select will be the column used for creating the group.
Tableau will automatically sample the column and identify the values that make up the column. It will look like the following screenshot.
Step 2.) Select or Multi-Select Values to Assign to a Group
Tableau gives you a couple of different ways to select values and assign them to groups. The fastest is to select a value with your mouse, or hold down CTRL on your keyboard to select multiple values at once. Then click the “Group” button at the bottom of the window.
Note: You can multi-select by left clicking multiple items while holding down CTRL or you can select a range of values by holding down SHIFT and select the top and then the bottom of the range that you want to select.
After clicking “Group” you will have the option to rename the group. In our example we are going to rename the group containing Boston and New York to East.
Step 3.) Option to include “Other”
We recommend using the Include “Other” group whenever possible. While some datasets have a distinct set of values that never change, many datasets will vary over time as new locations, new product categories, or even typos and errors are typed into source data.
When you choose to Include “Other’ Tableau creates a group for any items that were not specifically categorized, giving you a place to review them later.
Tip: On some dashboards you may even want to create a custom visual that shows you anything that is grouped into the “Other” category to periodically review and quickly identify when groups need to be updated or identify when errors occur.
Step 4.) Finalize Grouping
After assigning all desired values to a group, select OK. This will exit the Tableau group editor. You will have a new Grouped column created in your data source tab. The Group column will have a special icon of a paperclip and a globe letting you know that it’s a field of grouped values.
You can right click on the grouped column and edit it to make further adjustments.
When the group is finalized, you can switch to the sheet view where visuals are made. The new grouped column will show up in the Tables section of the Data Panel on the left side of the screen. You will be able to work with it like you would any other column.
The example below has the City Group as the first column, and the City as the sub-column of each item that makes up our custom groups. The groups can be worked with like other columns, such as adding subtotal levels or performing various formatting techniques.
Once you’ve grouped data together, let’s look at how to remove groups.
Use the Find Feature to Create Tableau Groups Faster
When creating groups in Tableau, you can launch the group editor and at the bottom of the window there is a “Find” button. When you launch the find section, you can search for any item that contains a specific value, or meets other criteria.
When Tableau finds a value that matches the listed criteria, it will automatically highlight all items that correspond to the condition. This lets you group all items and assign them very quickly.
This technique is especially useful when working with large data sets and you don’t want to have to scroll down an extremely long list to find specific values that you want to assign to a group.
How to Remove Groups in Tableau
To remove groups in Tableau, right click on a grouped column, select Edit Group. Select the group that you want to remove, and at the bottom of the group editor, you can select Ungroup. This removes the assigned items from a group.
As an alternative you can also drag and drop values from one group to another if you are trying to move them between different groups.
Grouping Data in Tableau Using Formulas
To create groups in Tableau using formulas, you can create a calculated field. Either right click on a column from the data source view, or from the data panel and select “Create Calculated Field” This launches the formula editor where you can type in an IF statement or use ELSEIF statements to assign different values to a category.
The first example below is a formula that utilizes IF and ELSEIF. When none of the conditions are met, we provide an ELSE to assign any non-listed values to an “Other” column.
A similar method that is useful when working with long lists of data is to use an IN statement, which is common in SQL. The IN statement lets you place multiple values in parenthesis with each unique value surrounded by quotes and separated by a comma.
Once you click OK the calculated field is generated as a new column in the dataset. The results are identical to using the Group Editor to manually assign values to a group.
You can learn more about creating IF statements here: Logical Functions – Tableau.
Using the grouping editor in Tableau is typically faster than custom writing formulas, but formulas can also be more powerful and give you more options such as wanting to see all of your grouping criteria in a single formula box, or giving you the ability to more dynamically allocate values to groups when they come through without having to manually adjust a pre-created group.
Creating groups in Tableau is a fundamental skill for data analysts and visualization experts. Whether you’re simplifying dimension data, categorizing items, or enhancing the structure of your visualizations, groups play a pivotal role.
You can either assign groups using the group editor, or you can use IF formulas. Both methods generate a new column and can come to the same results, but formulas tend to be easier to work with when there is identifiable logic to assign values to a group. Things like salesperson assigned to a specific city or territory may be best suited for manual grouping as they tend to change over time and rarely following logic that can be setup in a formula.
Either way, it’s always a good practice to document your grouping criteria, and make sure that ungrouped values can be easily identified if there is a change in your incoming dataset that needs to be addressed.