Tableau-operators

提供:Dev Guides
移動先:案内検索

Tableau-演算子

演算子は、特定の数学的または論理的な操作を実行するようコンパイラーに指示する記号です。 Tableauには、計算フィールドと数式を作成するために使用されるいくつかの演算子があります。

以下は、利用可能な演算子の詳細と操作の順序(優先順位)です。

オペレーターの種類

  • 一般的な演算子
  • 算術演算子
  • 関係演算子
  • 論理演算子

一般的な演算子

次の表は、Tableauでサポートされている一般的な演算子を示しています。 これらの演算子は、数値、文字、および日付のデータ型に作用します。

Operator Description Example
+(addition) Adds two numbers. Concatenates two strings. Adds days to dates.

7 + 3

利益+売上

'abc' + 'def' = 'abcdef'

#2004年4月15日#+ 15 =#4月30日

2004#

–(subtraction) Subtracts two numbers. Subtracts days from dates.

-(7+3) = -10

#2004年4月16日#-15 =#4月1日

2004#

算術演算子

次の表は、Tableauでサポートされている算術演算子を示しています。 これらの演算子は、数値データ型でのみ機能します。

Operator Description Example
*(Multiplication) Numeric multiplication 23*2 = 46
/(Division) Numeric division 45/2 = 22.5
%(modulo) Reminder of numeric division 13 % 2 = 1
^(power) Raised to the power 2^3 = 8

比較演算子

次の表に、Tableauでサポートされている比較演算子を示します。 これらの演算子は式で使用されます。 各演算子は、2つの数値、日付、または文字列を比較し、ブール値(TRUEまたはFALSE)を返します。 ただし、これらの演算子を使用してブール値自体を比較することはできません。

Operator Description Example
= = or = (Equal to) Compares two numbers or two strings or two dates to be equal. Returns the Boolean value TRUE if they are, else returns false. ‘Hello’ = ‘Hello’ 5 = 15/3
!= or <> (Not equal to) Compares two numbers or two strings or two dates to be unequal. Returns the Boolean value TRUE if they are, else returns false. ‘Good’ <> ‘Bad’ 18 != 37/2
> (Greater than) Compares two numbers or two strings or two dates where the first argument is greater than second. Returns the boolean value TRUE if it is the case, else returns false. [Profit] > 20000 [Category] > ‘Q’ [Ship date] > April 1, 2004
< (Less than) Compares two numbers or two strings or two dates where the first argument is smaller than second. Returns the boolean value TRUE if it is the case, else returns false. [Profit] < 20000 [Category] < ‘Q’ [Ship date] < April 1, 2004

論理演算子

次の表は、Tableauでサポートされている論理演算子を示しています。 これらの演算子は、結果がブール値である式で使用され、TRUEまたはFALSEとして出力されます。

Operator Description Example
AND If the expressions or Boolean values present on both sides of AND operator is evaluated to be TRUE, then the result is TRUE. Else the result is FALSE. [Ship Date] > April 1, 2012 AND [Profit] > 10000
OR If any one or both of the expressions or Boolean values present on both sides of AND operator is evaluated to be TRUE, then the result is TRUE. Else the result is FALSE. [Ship Date] > April 1, 2012 OR [Profit] > 10000
NOT This operator negates the Boolean value of the expression present after it. NOT [Ship Date] > April 1, 2012

演算子の優先順位

次の表に、演算子が評価される順序を示します。 一番上の行の優先順位が最も高くなります。 同じ行の演算子の優先順位は同じです。 2つの演算子の優先順位が同じ場合、式の左から右に評価されます。 括弧も使用できます。 内側の括弧は外側の括弧の前に評価されます。

Precedence Operator
1 –(negate)
2 ^(power)
3 *,/, %
4 +, –
5 ==, >, <, >=, ⇐, !=
6 NOT
7 AND
8 OR