Title: Tableau - Operators
1Tableau - Operators
Tableau
Swipe
2Tableau - Operators
An operator is a symbol that tells the compiler
to perform specific mathematical or logical
manipulations. Tableau has a number of operators
used to create calculated fields and
formulas. Following are the details of the
operators that are available and the order
(precedence) of operations.
3Types of Operator
General Operators Arithmetic Operators
Relational Operators Logical Operators
4General Operators
Following table shows the general operators
supported by Tableau. These operators act on
numeric, character, and date data types.
Operator
Description
Example
Adds two numbers. 7 3 Concatenates two
(addition)
Profit Sales
strings. Adds days to
'abc' 'def'
dates.
'abcdef'
April 15, 2004 15 April 30, 2004
5Operator
Description
Example
-(73) -10 April 16, 2004 - 15 April 1,
(subtraction)
Subtracts two
numbers. Subtracts
days from dates.
2004
6Arithmetic Operators
Following table shows the arithmetic operators
supported by Tableau. These operators act only
on numeric data types.
Operator
Description
Example 232 46
(Multiplication)
Numeric
multiplication
/(Division)
Numeric
45/2 22.5
division
(modulo)
Reminder of
13 2 1
numeric division
Raised to the power
(power)
23 8
7Comparison Operators
Following table lists the comparison operators
supported by Tableau. These operators are used
in expressions. Each operator compares two
numbers, dates, or strings and returns a
Boo lean (TRUE or FALSE). Booleans the mselves,
however, cannot be compared using these
operators.
8Operator
Description
Example
or (Equal to)
Compares two numbers or two strings or two dates
Hello Hello 5 15/ 3
to be equal. Returns the Boolean value TRU E if
they are, else returns false.
! or ltgt (Not
Com pares two
Good ltgt Bad 18 !
equal to)
numbers or two
37 / 2
strings or two dates
o
t
be unequal.
Returns the Boolean val ue TRUE if they
are, else ret urns false.
9Operator
Description
Example
gt (Greater than)
Compares two numbers or two strings or two
dates where the first
Profit gt 20000 Category gt Q Ship date gt
April 1, 2004
argument is greater than second. Returns the
boolean value TRU E if it is the case, else
returns false.
lt (Less than)
Compares two
rofit lt 20000
P
num bers or two
Category lt Q
strings or two dates whe re the first
Ship date lt April
1, 2004
argument is smaller than second. Returns the
boolean value TRUE if it is the case, else
returns false.
10Logical Operators
Following table shows the logical operators
supported by Tableau. These operators are used
in expressions whose result is a Boolean giving
the output as TRUE or
FALSE. Operator
Description
Exa mple
AND
If the expressions or
Ship Date gt April
Boolean values 1, 2012 AND present on both
sides Profit gt 10000 of AND operator
is evaluated to be TRUE, then the result is
TRUE. Else the result is FALSE.
11Operator
Description
Example
If any one or both of the expressions or
Boolean values
Ship Date gt April 1, 2012 OR Profit gt 10000
OR
present on both sides of AND operator
is eva luated to be TRUE, then the result is
TRUE. Else the result is FAL SE.
This operator NOT Ship Date gt neg ates the
Boolean April 1, 2012
NOT
val ue of the exp ression present after it.
12Operator Precedence
- The following table describes the order in which
operators are evaluated. - The top row has the highest precedence.
Operators on the same row have the same
precedence. - If two operators have the same precedence, they
are evaluated from left to right in the formula. - Also parentheses can be used.
- The inner parentheses are evaluated before the
outer parentheses.
13Operator Precedence
Precedence
Example
1 2 3 4
(negate) (power) , /, ,
5
, gt, lt, gt, lt, !
6
NOT
7
AND
8
OR
14Topics for next Post
Tableau - Functions Tableau - Bar Chart Tableau
- Line Chart Stay Tuned with