Tableau Operator

Facebooktwitterredditpinterestlinkedinmailby feather

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.

Given-below is a brief explanation of all the above 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.

  1. Addition or ‘+’

In Tableau the addition operator is used to add two numbers or to concatenate two strings or to add days to dates.

For example: 1.) Adding numbers:

2.) Concatenating Two Strings:

3.) Adding Dates:

  1. Subtraction or ‘-’

The subtraction operator in the tableau is either used to subtract one number from another or to subtract dates.

For example: 1.) Subtracting numbers:

2.) Subtracting Dates

Arithmetic Operators

These operators are used to perform all the mathematical calculations. And these operators act only on numeric data types.

  1. Multiplication or ‘*’

The multiplication operator is used for numeric multiplication, i.e., to multiply one number from another.

For example:

  1. Division or ‘/’

The divide operator is used for numeric division, i.e., to divide one number from another.

For example:

  1. Modulo or ‘%’

The modulo operator is used to find the remainder after dividing the one number from another.

For example:

  1. Power or ‘^’

The power operator is used to find the exponent of a value.

For example:

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.

  1. Equals to or ‘==’

The ‘Equals to’ operator compares whether the given two strings, numbers or two dates are equal or not. It returns a Boolean value TRUE if both the fields are identical, else it returns false.

For example:

  1. Greater than or ‘>’

The ‘Greater than’ operator compares the given two numbers, strings, dates, and checks whether the specified first argument is greater than the second argument. It returns a Boolean value TRUE if it satisfies the above case, else it returns FALSE.

For example:

  1. Greater than equal to or ‘> =’

The ‘Greater than equal to’ operator compares the given two numbers, strings or dates, and checks whether the specified first argument is greater or equal to the second argument. It returns a Boolean value TRUE if it satisfies the above case, else it returns FALSE.

For example:

  1. Smaller than or ‘<’

The ‘Smaller than’ operator compares the given two numbers, strings or dates, and checks whether the specified first argument is smaller than the second argument. It returns a Boolean value TRUE if it satisfies the above case, else it returns FALSE.

For example:

  1. Smaller than equal to or ‘< =’

The ‘Smaller than equal to’ operator compares the given two numbers, strings or dates, and checks whether the specified first argument is smaller or equal to the second argument. It returns a Boolean value TRUE if it satisfies the above case, else it returns FALSE.

For example:

  1. Not equals to or ‘!=’ or ‘<>’

The ‘Not equals to’ operator compares whether the given two strings, numbers or two dates are equal or not. It returns a Boolean value TRUE if both the fields are unequal, else it returns false.

For example:

Logical Operators

Logical Operators returns Boolean values giving the result as TRUE or FALSE.

  1. AND

The ‘AND’ operator returns a Boolean value TRUE if either the expressions or the Boolean values present on the sides of AND operator is estimated to be TRUE. Else it returns FALSE.

For example:

  1. OR

The ‘OR’ operator returns a Boolean value TRUE if any of the given expression and Boolean or both the expressions and the Boolean values present on the sides of OR operator is estimated to be TRUE. Else it returns FALSE.

For example:

  1. NOT

The ‘NOT’ operator negates the Boolean value of the expression that is present after it.

For example:

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 = += -= *= /= %= &= ^= |= <<= >>=>>>=

 

Facebooktwitterredditpinterestlinkedinmailby feather