Learn the different techniques to implement Tableau Group, Hierarchy, Sets, Sort features to create the best data visualizations.
Sort Data
Data available in the worksheet can be sorted based on the requirement. Data can be sorted based on the data source such as ascending, descending order, or depend on any measured value. There are mainly two ways of sorting the data:
- Manual Sorting: It rearranges the order of dimension fields by dragging them next to each other in an ad hoc manner.
- Computed Sorting: This sort is directly applied on the axis using the sort dialog button.
The steps to sort data are given below:
Consider a data source named Sample – Superstore, and you want to sort the dimensions and measures fields.
Step 1: Add the data source with the Tableau and drag the Order table.
Step 2: Go to the worksheet and drag the Category field (dimension) to row shelf and Sales field (measures) to the column shelf.
It will create a horizontal bar chart by default. The Category field is present in the visual order, and it can be sorted based on data source by default. The Sort order can also be changed.
Step 3: Right-click on the field Category and select Sort option.
It will open a Sort window. All options available in the Sort window are given below:
Sort By: The different types of methods to sort a field are:
- Data Source Order: It will sort the field based on the data source order.
- Alphabetic: It will sort the fields in alphabetical order.
- Field: It will sort the fields based on other measure or dimension values.
- Manual: It will sort the data manually.
Sort Order
- Ascending: It will sort the dimensions and field in ascending order.
- Descending: It will sort the dimensions and field in descending order.
Suppose you want to sort the Category field based on another field Sales.
Step 1: Click on the Field radio button.
Step 2: Select the name of the field on which the field Category is to be filtered.
Step 3: Select the type of aggregation.
Step 4: Click on the button Clear.
It will sort the Category field based on the sum of Sales in ascending order.
Data can also be sorted using the single-click option from a header, an axis, or field label.
One-click means will sort the data in ascending order, two-click means it will sort the data in descending order, and three-click means it will clear the sorts.
Sort on the basis of an Axis:
To sort on the basis of an axis, float over a numerical axis to get the sort icon and click on that icon.
Here, the sort is applied on Color rows based on the values of Metric A. It means that Color rows will sort inside Hue.
To sort from a header, float over a header to get the sort icon and click on that icon.
Here, the sort is applied to a Material column such as Paint, Paper, and Fabric based on the values of Green.
Sort on the basis of a Field Label:
To sort on the basis of a field, float over a field label. Here the sort icon will have a slight difference as compare to axis or header. Alphabetical Sorting is the default option, but you can change the sort order.
Here, the sort is applied to the outermost dimension, such as Hue is based on Metric B.
Create Groups
Groups are used to combine related members present in a field.
Consider a data source such as Sample – Superstore. Drag the Sales field in the column shelf and Category field in row shelf.
The aggregate values of Furniture and Office Supplies can be obtained by using the group.
The steps to create a group are given below:
Step 1: Right-click on the field Category.
Step 2: Click on the option Create.
Step 3: Select option Group.
Step 4: It will open a Create Window group. Enter the name of the group, select the members you want to group, and click on the Group button.
Step 5: It will open an Edit Group window. It will create a group of Furniture and Office Supplies. Click on the OK button.
It will create a group named as Category (group) and add it in dimensions list.
Create Hierarchy
Hierarchy is an arrangement where entities are presented at various levels. It is used to visualize the data at a granular level.
Consider a data source such as Sample – Superstore and its dimensions and measures.
The steps to create a hierarchy are:
Step 1: Go to the worksheet and select a dimension. Right-click on the dimension to create a hierarchy.
Select the option Hierarchy and then click on Create Hierarchy.
Step 2: It will open a Create Hierarchy window. Enter the name of the hierarchy and click on OK.
The hierarchy will be created, as shown below:
Step 3: You can also add another field. For example, the field State can also be inserted into the Country hierarchy.
Remove a Hierarchy
Inbuilt hierarchy can also be removed.
Step 1: Select the name of the hierarchy you want to remove.
Step 2: Right-click on the hierarchy.
Step 3: Select the option Remove Hierarchy.
Build Sets
Sets are the custom fields, and it contains a subset of data based on some conditions. Sets are created as a set of members out of the field present in a data set.
The steps to create sets are:
Step 1: Go to the worksheet and right-click on the dimension Sub-Category. Select the option Create and then click on the option Set.
Step 2: It will open a Create Set window. Enter the name of the set, select the members you want to add in the set, and click on OK.
It will create a set of selected members.
Show Members in Set
After the set is created, you can also see the selected members of a set:
Step 1: Right-click on the set.
Step 2: Click on the option Show Members.
It will then show all the selected members of the set.
Edit the Set
After the creation of a set, it can also be edited to add or remove the members of a set.
Step 1: Right-click on the set.
Step 2: Click on the option Edit Set.
After clicking on the Edit Set option, an Edit Set window will open. You can edit the members here: