Tableau Operator
Operator in Tableau
An operator is referred to as a symbol that often tells the compiler to execute certain mathematical or logical operations. Tableau accepts the same operators which are used by the other spreadsheet program. It has very straightforward operators which are used to create calculated expressions and formulas. For example: +, -, *, / etc. In general, Tableau supports four types of operators:- General Operators
- Arithmetic Operators
- Relational Operators
- Logical Operators.
Tableau General Operators
They are the basic operators which are used in calculations and concatenation of Strings. These operators can act on numeric, character, and date data types.- Addition or ‘+’
7+ 9 = 162.) Concatenating Two Strings:
‘ HELLO’+ ‘WORLD’= ‘HELLOWORLD’3.) Adding Dates:
#MAY 22, 2019# + 5 = #MAY 27, 2019#
- Subtraction or ‘-’
7- 9 = -22.) Subtracting Dates
#MAY 22, 2019# - 5 = #MAY 17, 2019#
Arithmetic Operators
These operators are used to perform all the mathematical calculations. And these operators act only on numeric data types.- Multiplication or ‘*’
18 * 2= 36
- Division or ‘/’
18 / 2 = 9
- Modulo or ‘%’
19 % 2= 1
- Power or ‘^’
2^4 = 16
Relational Operators
Relational Operators are also known as comparison operators. It is used to compare one value with another. These operators can act on numeric, character, and date data types. The result is returned in a Boolean value, i.e., either TRUE or FALSE.- Equals to or ‘==’
‘Hello’ = ‘Hello’
5=5 == TRUE
- Greater than or ‘>’
‘Hello’ > ‘Tableau’
5>7 == FALSE
- Greater than equal to or ‘> =’
‘Hello’ >= ‘Hello’
5>=5 == TRUE
- Smaller than or ‘<’
‘Hello’ < ‘Tableau’
5< 7 == TRUE
- Smaller than equal to or ‘< =’
'Hello’ <= ‘Hello’
5<=5 == TRUE
- Not equals to or ‘!=’ or ‘<>’
‘Hello’ <> ‘Tableau’
5<>7 == TRUE
Logical Operators
Logical Operators returns Boolean values giving the result as TRUE or FALSE.- AND
[Ship Date] > #March 23, 2019# AND [Loss] > 89000
- OR
[Ship Date] > #March 23, 2019# OR [Loss] > 89000
- NOT
[Ship Date] > #March 23, 2019# NOT [Loss] > 89000
OPERATOR PRECEDENCE
Tableau also follows the operator precedence order for evaluating its calculations. Operators which are present on the same row also have the same precedence. And if two operators have the same priority, they are weighed from left to right in the formula for the calculations. The parentheses can also be used, but the inner brackets are valued before the outer parentheses. The following table describes the priority in which operators precedence are decided:
OPERATORS |
PRECEDENCE |
postfix increment and decrement | ++, -- |
Negate prefix increment and decrement, and unary | ++, --, -(negate), ~ ! |
Power | ^ |
Multiplicative/divide/ Modulo | * / % |
Additive/ subtractive | + - |
Shift | <<>>>>> |
Relational | <><= >= instanceof |
Equality | == != |
logical AND | && |
logical OR | || |
Assignment | = += -= *= /= %= &= ^= |= <<= >>=>>>= |