Give a chestnut! Tableau Tips (43): Tips for displaying some labels in the chart

发布于: 2021-05-31

There is a small application point, and many Tableau users cannot find a solution, that is: how to display only some labels in the worksheet, others do not want to display.

For example, the following line chart with cluttered or even overlapping labels looks particularly messy, and does not even know which point the label shows.

If this is the case, only the months with more than 400,000 sales are displayed. The chart immediately became clear, right?

If you need to manually remove the unwanted tags one by one, it is too time-consuming and laborious.

Is there a simpler and faster way?

In this issue of "Choose a Chestnut", the Tableau technique that Ada wants to share with you is: a small trick to display some labels in the chart.

In fact, to achieve this effect, only need to write a calculated field. Let's take the supermarket data provided by Tableau as an example.

Specific steps are as follows: 

Step 1:Create a line chart

Drag the order date to the column and the sales amount to the row, click the order date drop-down to select a multi-value month, and create the following figure.

Step 2:Create calculated fields

If you don't want the extra labels to be displayed, just assign a null value. Click to create a calculation field and enter in the calculation box:

IF SUM ([Sales])> 400000 then sum ([Sales])

ELSE null

END

Step 3:Drag the calculated field to the label

Next, we drag the created calculated field "Label greater than 400K" to the label

In this way, just write a calculated field, and the extra labels will no longer be displayed.