KNOWLEDGE BASE

Changing a Constant Reference Line by Filter


Published: 03 Feb 2016
Last Modified Date: 14 Apr 2017

Question

How to create a dynamic reference line that shows a different constant value for different filter values?

Environment

  • Tableau Desktop

Answer

Create an IF/THEN logic calculated field that lists constants to use for each filter value that is contained within an ATTR() function to prevent automatic aggregation. The calculated field is then dragged out to details, and used for the reference line.

There is an attached .twbx which demonstrates this with Salesforce data, using Region as the filter, that includes a reference line that changes by region:

ATTR(IF [Region]="West" Then 2000
ELSEIF [Region]="East" Then 5000
ELSEIF [Region]="Central" Then 1000
ELSEIF [Region]="South" Then 3000
Else Null
END)
Did this article resolve the issue?