Lift a chestnut! Tableau Trise (129): Realize the data of the tree map with set operation

published: 2021-06-08

In Tableau, the tree map is embedded in the intelligent display. As long as the data conditions are met, data powder can be easily selected. The matrix type tree map, dimension determines the structure of the tree, and the metric defines the size or color of each rectangle.

This is the 4th chestnut 🌰 @棒棒的东 , we thank him.

Although the tree is simple and easy to use and very visual impact. However, trying to explore data through it, it takes a good job.

In fact, users of Tableau 2018.3 and above have used the interactive function of "set operation" to achieve data of the tree map. Today, I share this app through "a chestnut" and I hope to take a brick. 

The Tableau trick we want to share with you this issue is: Use the set operation to achieve the data of the tree map.

For the convenience of learning, chestnuts use Tableau to own the "example-supermarket" data source. After mastering the chestnut method, the data powder can try to use its own data.

Specific steps are as follows:

1. Connect the data source

Open Tableau Desktop, connect to the "Example - Supermarket" data source.

 

2, create sets and calculation fields

1) Create a "category"

In the data pane, right click on the dimension "Category" and select "Create" - "Set" in the drop-down menu. Then, in the pop-up creation set dialog box, the Set Name is "Category Set", click the "OK" button.

 

2) Create a calculation field "Asymmetric subclass"

Right-click on the blank of the data pane and select "Create" - "Calculate Field" in the drop-down menu. Name the calculation field: asymmetric subclass, then type the following functions:

IF [category] Else [Category] end

 

3) Create a "subclass"

In the data pane, right click on the dimension "unsmicer subclass" and select "Create" - "Set" in the drop-down menu. Then, in the pop-up creation set dialog box, the setting name is "subclass set", click the "OK" button.

4) Create a calculation field "asymmetric product name"

Right-click on the blank of the data pane and select "Create" - "Calculate Field" in the drop-down menu. Name the calculation field: asymmetric product name, then type the following functions:

IF [subclass] THEN [Product Name] ELSE "" END

 

3, create views and set operations

1) Generate a tree map

In the data pane, double-click the metric "Sales" and the dimension "category", open "Intelligent Display" to select "Tree Map"; will calculate the "unsmicer subclass" and "asymmetric product name" and metrics " Sales "Drag and drop" Tags "in the" Mark "card; drag and drop the dimension" category "in the" Tag "card to" Tag "into" Details ".

 

2) Create a "set operation"

Select "Worksheet" in the top menu - "Operation", click Add Action - "Change Set Value" in the pop-up dialog box. Then, set the "Diamond Query Subcarrelation" in the pop-ups: Source Worksheet Select the current worksheet, run the operation mode "Select", the target set is "Category Set", and select "Remove all values from the centralized".

 

Similarly, set the "Diamond Query Product Name", the source worksheet selection the current worksheet, run the operation mode "Select", the target set is "subclass", select "Remove all values from the concentrated".

This completes the settings of the seamless drop analysis of the seamless drop. Let's take a look at the effect:

- Take furniture as an example, click on furniture in the tree map, will drop the subclass data view of the subordinates of the furniture:

 

- Take the chair subclass with furniture as an example, click on the chair in the tree map, will drop the product name data view of the population under the chair:

 

This issue of Tableau skills, have you get? Try it quickly!