It is easy to create a “Group” of a dimension in Tableau, but how to make this process dynamic? For instance, you have a dimension called “States” that includes different states’ names and another dimension “Sales” showing the sales of each state. And you create a bar chart to show the sales of each state. However, instead of showing all the states, you want to enable users to choose how many states to show according to a condition they set. In the Tableau Sheet shown below, but typing in a different number in the right box, the users can dynamically group the states whose sales are under 100000 into others and show the states whose sales are higher than 100000.
Step 1: Set a parameter
To enable users to customize the chart based on their needs, a parameter is needed. In this example, the condition is the value of the sales. Thus, you need to create a parameter as shown in the picture below:
Step 2: Create a set
Create a set “State Set” based on the condition “SUM([Sales])>[Group States Sales Less Than]”. The parameter is inserted in this condition which is the key to making the group dynamic.
Step 3: Create the Group
Create a group “Sates and others” as shown below and then drag “Sales”, “States and others” into Rows and Columns. Then you will see the dynamic group is done! What’s more, if you want to colour the bar, put the set “State Set” into colour. Then you’ll get the bar char like the one in the first picture.