How to Create Groups in Tableau

When I was working on a Tableau dashboard to analyse sales performance, I noticed that the dataset had too many product sub-categories, like Accessories, Appliances, Chairs, Copiers and many more. From these multiple categories, we wanted to show the profit of the selected sub-categories only.

For this, it was required to group those sub-category fields. In Tableau, we can group the measures and dimensions in multiple ways.

In this Tableau tutorial, I will explain all the possible ways through which we can create groups in Tableau.

Groups in Tableau

In Tableau, grouping fields is a way to combine multiple dimension members into a single, higher-level category. After creating a group, the grouped field appears in the Data Pane and can be renamed or edited, making it reusable across multiple worksheets.

In Tableau, creating a group is useful when we want to simplify dashboards, fix data issues like spelling mistakes, or create custom categories such as “High Profit States.”

To create a group, we can either select items directly in a visualisation and right-click to group them, or use the Data Pane by right-clicking on a field and choosing Create -> Group.

Types of Groups in Tableau

In Tableau, there are three types of grouping that we use to group the fields.

  • Visual Grouping – In Tableau, visual grouping allows us to combine values directly in the visualisation. This grouping is not dynamic; that’s why if data changes, we need to regroup manually. For example, we created a group to show the top n results. For this, a new group in the Data pane is automatically created that can be used on the chart.
  • Discrete Grouping – In Tableau, discrete groups are created in the Data pane and saved as new fields. They are reusable across different views, filters, and calculations. This grouping is created when we want to correct spelling errors or create reusable custom categories.
  • Conditional Grouping – In Tableau, conditional grouping creates a group using a calculated field. In the calculation, we define a condition using the IF-ELSE conditionals. Then, the fields are grouped based on values, for example, if a customer’s profit is more than 2000, then it will be in group “high profit.”

Create Groups in Tableau

In the examples below, we will create all three types of grouping that are Visual Grouping, Discrete Grouping and Conditional Grouping.

Create Visual Grouping in Tableau

In this grouping method, we can group the fields directly from the view instead of the Data pane. In this example, we will create a grouping of the top 5 Product Sub-Category by Sales using the Tableau Superstore data set.

Now, connect Tableau with the Superstore dataset and follow the steps below.

  1. To create the bar chart view, add the Sales to the Columns and Sub-Category to the Rows.
  1. Now sort the sales in decreasing order so that we can select the top 5 sub-categories by sales.
  1. For grouping, select the top 5records and then right-click -> select Group.
Create Grouping in Tableau
  1. Now, a new group is created in the Data Pane, and the bar chart will also display the sales of the selected sub-category combined.
Create Visual grouping in Tableau

In this grouping, if sales data changes and the top 5 sub-categories are different, the grouping won’t update automatically. In that case, we need to regroup the fields.

Create Discrete Grouping in Tableau

In Tableau, discrete grouping creates a new grouped field in the Data Pane that can be reused across multiple dashboards. In this method, we will create a grouping from the data pane.

In this example, we will group the sub-categories Table and Chair in one group as Furniture. To create this discrete grouping, follow the steps below.

  1. To create the grouping, go to the Data pane -> Sub-Category -> Create -> Group.
Create Discrete Grouping in Tableau
  1. In the Field Name, enter the name for the group. Then select the fields for grouping and click on the Group button.
Create Grouping in Tableau Fields
  1. Now, the selected fields will be grouped; after this, click on the OK button.
How to Group Fields in Tableau

Now, the group will appear in the data pane from where it can be reused in filters, calculations, or across other visualisations.

Tableau Field Grouping

This method is useful when we want consistent, reusable, custom grouped fields.

Create Conditional Grouping in Tableau

In this grouping, we can create a grouping that groups values based on specific rules. Instead of manually selecting items, we create a calculated field with conditions.

In this example, we will create a group to classify Sub-Categories by Profit into High, Medium, Low, or Loss.

Now, follow the steps below to create a conditional grouping in Tableau.

  1. To create a calculated field, go to the Data Pane, right-click Profit -> select Create -> Calculated field.
Create Conditional grouping in Tableau
  1. Label the calculated field as Profit Grouping and enter the formula below that will group the fields based on conditions. After validating the formula, click the OK button.
IF SUM([Profit]) >= 20000 THEN "High Profit"
ELSEIF SUM([Profit]) >= 10000 THEN "Medium Profit"
ELSEIF SUM([Profit]) > 0 THEN "Low Profit"
ELSE "Loss"
END
  1. To visualise the data, create a bar chart with Sub-Category on Rows and SUM(Profit) on Columns.
Create Grouping using calculated field in tableau
  1. Now, add the calculated field, Profit Grouping, to the Colour card in the Marks section.
How to create conditional grouping in Tableau

Now, we can see the values of Sub-Categories divided according to the conditions that we have applied in the calculated fields.

This way, we create conditional grouping in Tableau using a calculated field.

Conclusion

In this tutorial, we learned how to create groups in Tableau using three different methods: Visual Grouping, Discrete Grouping, and Conditional Grouping.

By following the grouping methods from the above example, we can simplify dashboards and highlight specific data. According to the requirements, we can choose from a quick one-time grouping, a reusable category, or a dynamic grouping based on conditions.

You may also like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.