Last Modified Date: 20 Jul 2023
Environment
Tableau DesktopAnswer
Option 1 - Based on field values
Using calculated fields, you can create conditional data labels based on a custom field that includes only the values of interest. This step shows how to create a conditional label that appears on a mark only when a region’s sales for a day are greater than $60,000.
Step 1: Create a calculated field
- Select Analysis > Create Calculated Field.
- In the Calculated Field dialog box:
- Name the calculated field. In the example workbook, the calculated field is named "Outlier".
- In the formula field, create a calculated field similar to the following:
IF SUM([Sales])> 60000 THEN SUM([Sales]) ELSE null END
- Click OK.
Step 2: Build the view
- From the Measures pane, drag Sales to the Rows shelf.
- From the Dimensions pane, drag Order Date to the Columns shelf, and then drag Region to Columns.
- Right-click Order Date and select Month (as a discrete field).
- Drag the new calculated field Outliers to the Labels mark card.
Option 2 - Based on a parameter selection
The following solution uses Segment from the Superstore data set. Replace all instances of Segment with your dimension field.
- Create a new parameter - this example names it 'Choose Segment'.
- Leave it as a string and from the Add from Field option choose the dimension that will show a single label.
- From the Analysis menu, choose Create Calculated Field and type a formula similar to the following:
IF [Segment] = [Choose Segment] THEN [Segment] ELSE '' END
- Drag the original Dimension (Segment) onto the Columns shelf
- Drag the new calculated field right after it onto the Columns shelf.
- Right click and hide the first dimension by deselecting Show Header.
- Show the parameter and select the label that should be shown.
Additional Information
To view the steps in Option 1 in action see the video below.Note: the video has no sound.
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials