Wednesday, March 6, 2013

[TABLEAU] Conditional Data Labels


               Conditional Data Labels

You may have already figured out that you can place a field on the Label shelf to add data labels based on the values of that field. However, often you find that you do not actually want to label every mark; rather, you may want to label only the outliers, or only the data within your region. Using Tableau's calculated fields, you can create conditional data labels based on a custom field that includes only the values of interest. 

Say you are analyzing the daily regional sales for a supermarket and you want to label all regions that have sales greater than $130,000. By dragging the Sales field to the Label shelf, you add data labels based on the sales for each region.






Create a calculated field.


Step 1
Select Analysis > Create Calculated Field.


Step 2
In the Calculated Field dialog box, name the field "Outliers" and write a conditional formula that describes the marks you want to label. For example, the formula to label only regions where the sales are greater than $130,000 looks like this:
 
IF SUM([Sales])>130000
THEN SUM([Sales])
ELSE null END
If the region's sales are greater than $130,000...
then label the marks with the Sales total...
otherwise don't add a label at all.




The Calculated Field dialog box should look like this:





Step 3
Drag the new Outliers field onto the Label shelf, replacing Sales.






The final view includes only data labels for the regions where the sales total is greater than $130,000.







  • Note : You can show or hide the data labels for individual marks. To hide a specific data label, right-click the mark and select Mark Label > Never Show.










1 comment:

  1. All we need to complete your order is the information located on our order form and pictures of the labels you wish to receive.

    auto data labels

    ReplyDelete