Tableau Calculation – Using the IN operator

Tableau Calculation – Using the IN operator

2023.01.17

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

(和文はこちらから)

Introduction:

When using calculated fields in Tableau, it is possible to use the “IN” operator. Its behavior is similar to its SQL equivalent operation. This can bypass multiple “OR” statements by clubbing various clauses together.

The “IN” operator can be used in calculated fields to test whether a specified value matches any value in a list of comma separated values, or a set, or combined fields like City/State combinations etc. The “IN” operator supports string, numeric, date, and boolean data types.

How to use "IN" operator:

Let us consider a string calculation as shown below:

Until now, the “IF” statement would get bigger with multiple “OR” clauses. However, by using the “IN” operator, the same calculation can be simplified as shown below.

In both cases the output would be the same as shown below.

The “IN” operator in Tableau behaves similarly to its SQL equivalent however, while SQL users can further use the “NOT IN” syntax, the latter is not yet allowed in Tableau.

Summary:

Use the “IN” operator in various calculated fields and tidy up your work.


Tableauの導入支援はクラスメソッドにおまかせください

クラスメソッドでは、お客様のTableau導入時のオンボーディング(各種トレーニング、ナレッジ共有など導入ノウハウの提供)を行っております。データ分析環境の豊富な導入実績を持つクラスメソッドが、お客様のTableau導入を支援いたします。
Tableauの導入支援サービスを見る

この記事をシェアする

関連記事