KNOWLEDGE BASE

Published: 07 Oct 2013

### Question

How to create an adjustable reference line.

### Environment

Tableau Desktop

The following instructions can be reviewed in the attached workbook using the Sample - Superstore data source.

CLICK TO EXPAND SOLUTION

### Create a calculated field, a reference line and a parameter

##### Step 1: Create the calculated field
1. Drag Sales to Rows.
2. Select Analysis > Create Calculated Field.
3. In the Calculated Field dialog box, do the following and then click OK:
• Name the calculated field. In the example workbook, the calculated field is named Target.
• In the formula field, create a calculated field similar to the following:
`SUM([Profit])`
4. Drag Target to Detail.
##### Step 2: Create the reference line
1. Right-click the vertical axis, and select Add Reference Line.
2. In the Add Reference Line dialog box, do the following, and then click OK:
• For Scope, select Entire Table.
• For Value, select AGG(Target) and Sum.
##### Step 3: Create the parameter
1. Click the drop-down arrow to the right of Dimensions on the Data pane and select Create Parameter.
2. ​In the Create Parameter dialog box, do the following, and then click OK:
• Name the parameter. In the example workbook, the parameter is named Adjustable Target.
• For Data Type, select Float.
• For Display Format, select Percentage.
• For Allowable values, select Range.
• Click Set from Field > Target.
• For Range of values, for Minimum, enter 0, and for Maximum, enter 100.
1. Click the drop-down arrow next to the parameter and then select Show Parameter Control.
2. In Measures, click the drop-down arrow next to Target, and then select Edit.
3. In the Formula field, enter the following formula, and then click OK
`SUM([Profit])*[Adjustable Target]`

To view these steps in action, see the video below:
Note: the video has no sound.