Tableau Operators: Arithmetic, Comparison and Logical

Tableau Operators: Arithmetic, Comparison and Logical

3 mins read582 Views Comment
Vikram
Vikram Singh
Assistant Manager - Content
Updated on Apr 10, 2022 21:17 IST

In this article we will discuss different operators in Tableau like arithmetic, comparison and logical operators.

2022_04_Operators-in-TABLEAU.jpg

Introduction

In this article, we will discuss operators in Tableau.

In computer programming operators are the symbols that are used to perform specific mathematical or logical manipulations.

In Tableau, we mainly have 3 types of operators letโ€™s discuss them briefly

Recommended online courses

Best-suited Tableau courses for you

Learn Tableau with these high-rated online courses

โ‚น39.54 K
2 hours
โ€“ / โ€“
45 hours
โ€“ / โ€“
4 weeks
โ€“ / โ€“
4 weeks
โ‚น2.25 K
4 weeks
Free
12 hours
โ€“ / โ€“
1 hours
โ‚น19.89 K
16 hours
โ€“ / โ€“
3 hours
โ‚น19.7 K
6 months

Table of Content:

Arithmetic Operators:

An arithmetic operator is a mathematical function that takes two operands and performs calculations on them.

The basic arithmetic operations are addition (+), subtraction (-), multiplication (*), division (/), modulo (%), power (^).

  • Addition (+)

When the + operator is applied, it means:

  • addition when applied to numbers
    • Eg: 5 + 5 = 10
  • Concatenation when applied to the string
    • โ€˜abcโ€™ + โ€˜defโ€™ = โ€˜abcdefโ€™
  • Add number of days to a date, when applied to dates
    • #April 4, 2022# + 6 = #April 10, 2022# 
  • Subtraction (-)

When the โ€“ operator is applied, it means:

  • Subtraction when applied to a number
    • 5 โ€“ 4  = 1
  • Negation when applied to an expression
    • โ€“ (5+5) = -10
  • subtract the number of days to a date, when applied to dates
    • #April 4, 2022# โ€“ 2 = #April 2, 2022# 
    • #April 4, 2022# โ€“ #April 2, 2022#  = 2
  • Multiplication (*)

When the * operator is applied, it means numeric multiplication.

  • 5 * 4 = 20
  • 9 * 9 = 81
  • Division (/)

When the / operator is applied, it means numeric division.

  • 5 / 2 = 2.5
  • 20 / 2 = 10
  • Modulo (%)

The modulo operator % returns the remainder in the division.

  • 7 % 2 = 1
  • 35 % 5 = 0
  • Power (^)

The power operator ^ means, raised a number to a specific power.

  • 2^3 = 8
  • 5^4 = 625

Comparison Operator

Comparison operators are used for the comparison of expression. Operators are used two compare numbers, dates, strings, and return a boolean.

Some of the comparison operators are:

Operator Description Example Return
= Equal โ€˜Naukriโ€™ = โ€˜Naukriโ€™
โ€˜Naukriโ€™ = โ€˜naukriโ€™
True
False
< >, != Not Equal 4.0 != 4 False
< Less than 2 < 4 True
< = Less than or equal 2 <= 4 False
> Greater than 2 > 4 False
> = Greater than or equal 4 >= 2 True

Logical Operators

Logical operators have only 3 operators: AND, OR, NOT.

  • AND Operator
    • It returns TRUE only if both the conditions are TRUE
    • It returns FALSE if either one or both the conditions are FALSE
  • OR Operator
    • It returns FALSE only if both the conditions are FALSE
    • It returns TRUE if either one or both the conditions are TRUE
  • NOT Operator
    • It returns TRUE if the following condition is FALSE
    • It returns FALSE if the following condition is TRUE

Order Precedence

PRECEDENCE OPERATOR
1 โ€“ (negate)
2 ^ (power)
3 *, /, %
4 +, โ€“
5 ==, >, <, >=, <=, !=
6 NOT
7 AND
8 OR

Conclusion

In this article, we have discussed operators in Tableau: Arithmetic, logical and comparison operators.

Hope this article will help you in your data analyst journey.

This article is a part of a complete tutorial of Tableau, focusing on Tableau certified data analysts and tableau desktop specialists. 

Through a series of articles, we will cover all the topics in-depth with examples.

Data Types in Tableau
Dimension and Measure in Tableau
Data Aggregation in Tableau
About the Author
author-image
Vikram Singh
Assistant Manager - Content

Vikram has a Postgraduate degree in Applied Mathematics, with a keen interest in Data Science and Machine Learning. He has experience of 2+ years in content creation in Mathematics, Statistics, Data Science, and Mac... Read Full Bio