Give a chestnut! Tableau Tips (98): Use data blending to modify field values in batches

published: 2021-05-26

In actual analysis scenarios, you may encounter such a problem: how to batch change all values of a field in the data source? The usual solution is to use data fusion, but solving the problem will be accompanied by some shortcomings, such as:

Data fusion affects the overall performance, and temporary tables will be created during the fusion process, which will increase calculation pressure;

Excessive data fusion will cause difficulties in subsequent maintenance. It is necessary to understand the role of each auxiliary table and the way it is implemented.

So, how to use strengths and avoid weaknesses to easily modify field values in batches? My suggestion: Use an auxiliary table. You don't need to keep it for a long time when it is used up. Just delete it.

As shown in the figure below, at first, only the country was coded with numbers, but later I felt that using the internationally-used country code would be more descriptive and representative, so I wanted to replace the value in the Number column in Figure 1 with the Country Code in Figure 2 Value. This effect can be achieved by using a field value in another data source to reassign the alias to the value in the data source.

 

 

In this issue of "Give a Chestnut", the Tableau technique that Ada wants to share with you is: use data mixing to batch modify field values.

Specific steps are as follows:

Step 1

First, set the original data source as the main data source (just drag a field from the main data source to enter the view). For example, if we drag Number into the row function area, we can see ✓ appears in the lower right corner of the main data source icon in the upper left corner.

Step 2

Then, click the connection icon on the right of the auxiliary data source Country to red to establish a connection with the main data source; and drag the Country Code field of the auxiliary data source into the row function area.

Select the Country Code capsule, click the drop-down triangle, and choose to edit the main alias.

You can see that there is a column of * under "alias", which indicates that the data source has the corresponding alias value.

Tips: If the asterisk is not displayed under "Alias", either the secondary data source does not have a corresponding alias to match the field value in the primary data source, or multiple field values in the primary data source have the secondary data source Same alias. In this case, the data in the secondary data source cannot be used to assign aliases to the field values in the primary data source.

Click OK in the previous step, and the value of Country Code will replace the value of Number.

Step 3

Finally, delete the auxiliary data source: select the auxiliary data source, right-click, and select close.

In the pop-up window, click OK.

Return to the data source interface, and finally get the effect as shown below: The value of a column corresponding to the main data source Number is replaced by a number with the international country code we want.

Have you gotten the Tableau skills in this issue? Give it a try!