KNOWLEDGE BASE

Adding Separate Dynamic Reference Lines For Each Dimension Member


Published: 01 May 2014
Last Modified Date: 13 Nov 2017

Question

How to add a dynamic reference line for each separate member in a dimension.

Environment

Tableau Desktop

Answer

The following instructions can be reproduced by connecting to the Sample - Superstore data.

Step 1 - Build the View

  1. Drag Sales to the Rows shelf.
  2. Drag Order Date to the Columns shelf.
  3. Drag Categories to the Rows shelf, left to the Sales measure.

Step 2 - Create Parameters

  1. Right-click in the Data pane and then select Create Parameter.
  2. Name the parameter "Furniture Goal".
  3. Under Data Type select Integer.
  4. Under Current Value, add the desired value.
  5. Under Allowable values select All.
  6. Click OK.
  7. Repeat Steps 1 through 6 for a parameter named "Office Supplies Goal".
  8. Repeat Steps 1 through 6 for a parameter named "Technology Goal".

Step 3: Create the calculated field

  1. Select Analysis > Create Calculated Field.
  2. Name the calculated field "Reference Line".
  3. In the formula field, enter the following formula:
    IF [Category]='Furniture' THEN [Furniture Goal]
    ELSEIF [Category]='Technology' THEN [Technology Goal]
    ESLE [Office Supplies Goal]
    END
    
  4. Click OK.

Step 4 - Use the calculated field as a Parameter Control

  1. Drag the "Reference Line "calculated field to Details.
  2. Click the arrow to change the measure from SUM to Minimum.
  3. In the view, right-click on the Sales axis and select Add Reference Line.
  4. In the Value drop down menu, select Minimum(Reference Line).
  5. In the Label drop-down menu, select Value.
  6. Click OK.
  7. Right-click each parameter and select Show Parameter Control.
  8. Adjust the Goal as desired by editing the Parameter Control. 

 

Additional Information

To view these steps in actions, see the video below: 
Did this article resolve the issue?