KNOWLEDGE BASE

Add a Reference Line to a Discrete Field


Published: 20 Jun 2014
Last Modified Date: 02 Jun 2016

Issue

Unable to add a reference line to a discrete field in the view.

Environment

Tableau Desktop

Resolution

As a workaround, create a calculated field that will plot lines where desired.
  1. Drag discrete field (i.e. [discrete month]) to the Columns shelf. 
  2. Drag measure (i.e.[profit]) to the Rows shelf.
  3. Select Analysis > Create Calculated Field.
  4. In the Calculated Field dialog box, create a formula similar to the following:
    IF [discrete month]="February" OR [discrete month]="July" THEN 10000 END
  5. Click OK
  6. Drag the newly created calculated field from the Dimensions pane to the Rows shelf, next to the [profit].
  7. Right-click on the calculated field and select Dual Axis.
  8. Go to the Marks card of the new calculated field, and change the Mark type to Bar.
  9. On the Marks card of the new calculated field, adjust the size of the bar to very small.
 

 

Cause

The ability to add a reference line to a discrete field is not currently available in Tableau Desktop. 

Additional Information

​The attached workbook shows an example of how the above approach can be implemented. 
Did this article resolve the issue?