Dynamically grouping and ungrouping dimensions in Tableau
top of page
  • Bernard K

Dynamically grouping and ungrouping dimensions in Tableau

Updated: May 22, 2021


Dynamically grouping and ungrouping dimensions in Tableau

What is grouping?

Grouping refers to act of combining related members in a field. For example, when working with data that contains country names, you might want to combine several countries to create a region e.g. combining Kenya, Tanzania, Uganda, Rwanda, Burundi and South Sudan to create ‘East Africa’ region.

Grouping data can also be useful in:

  • Correcting data errors e.g. combining Africa, Afrika, Afric, African, Afrikan into a single data point ‘Africa’

  • Answering what-if type of questions e.g. What would happen if we combine East and West regions?

Ways of grouping data in Tableau

There are several ways you can group related members in Tableau.

Grouping a field in the data pane

Right-click the field you want to group its members, Create >> Group…

Create a group in Tableau

Group related members by selecting them, and then click Group.

Rename your group accordingly.

grouping related members in Tableau

Grouping a field in the view

You can also group members by selecting related members in the view and then clicking on Group icon.

In this example, I would like to combine the highlighted countries to create a region called West.

Grouping members in a view

Creating dynamic groups using calculated field and parameter

Sometimes you might want to present your analysis using either grouped or ungrouped members of a dimension. To do so, you will need to leverage parameter with a calculated field.

In this example, using Superstores dataset, lets create a view that will be grouping product Sub-categories into ‘Technology’, ‘Furniture’ and ‘Office Supplies’ category.

Create parameter – ‘Group & Ungroup’

Create a parameter consisting a list of values as shown below.

Creating a parameter in Tableau

Create the calculated field below – Dynamic grouping/ungrouping

Tableau calculated field
  • Now drag the calculated field – Dynamic grouping/ungrouping to the rows shelf

  • Drag Sales to the columns

  • Show parameter control

Note by selecting group or ungroup in the parameter control will be grouping and ungrouping product Sub-categories into Technology, Furniture and Office supplies categories.

grouping and ungrouping fields in Tableau

I hope this article was somewhat helpful to you. To receive more of the Tableau tips and tricks, kindly join our mailing list by subscribing below.

Thank you for reading.

Blog.png
Black & white.jpg

About Me

More About the Author

Bernard K

Analytics Consultant | 3X Tableau Certified

Bernard is a data analytics consultant helping businesses reveal the true power of their data and bring clarity to their reporting dashboards. He loves building things and sharing knowledge on how to build dashboards that drive better outcomes.

Let’s discuss your data challenges! Let’s work together!

bottom of page