• Bernard

Tableau (IN) operator for calculations


Tableau IN operator is a logical function used to test whether a specified value matches any value in a list of comma-separated values, a set, or combined fields.

(Note: The IN operator supports string, date, numeric and Boolean data types)

IN Syntax

<expr1> IN <expr2>

Where the value of <expr1> can be a set, list on values or combined fields.

Example 1

SUM([Sales]) in (2,297,202, 2,340,789, 3,456,782)

This expression returns TRUE if SUM([Sales]) matches any value in the comma-separated values

Example 2

(This calculation returns ‘Eastern Africa’ for each country matching the comma-separated values)

I hope this was somewhat helpful to you.

Thank you for reading.