0
votes

Tableau version: 2018.1.3

Input table has 3 columns (timestamp, value, isSpecial).

The column isSpecial is 0 or 1

I am trying to build this plot:

X-axis: timestamp
Y-axis: value (marked as a line) and the special_value (marked as a circle)

I created the custom SQL:

SELECT timestamp, value,
CASE isSpecial
   WHEN 0 THEN NULL
   ELSE  value
END as special_value
FROM mytable

I added the columns "value" and "special_value" to the measurements values. Also, I formatted "special_value" to hide NULLs.

I want to plot "value" as a line and the "special_values" as a circle and Tableau does not allow me to select the different marks styles for different measures on the same plot.

1
Try to avoid custom SQL when there is an alternative way in Tableau (which is usually the case) Custom SQL defeats some query optimizations. In your case, you can drop the custom SQL, and instead, create a calculated field called special_value with the following definition "if value <> 0 then value end" (the quotes are not part of the calculation). The implied else clause evaluates as null.Alex Blakemore

1 Answers

0
votes

You need to create a Dual Axis chart to do that. Just drag value and special_value to the columns and select dual axis for the second item. Now you can select Mark Type for each measure.

enter image description here enter image description here