Lesson 3 of 7By Ravikiran A S

Last updated on Mar 11, 20211642#### Tableau Tutorial

Overview#### What Is Tableau: Power-Packed Tutorial for Beginners

Lesson - 1#### Tableau Dashboard: Your One-Stop Solution for the Dashboards in Tableau

Lesson - 2#### Tableau Functions: Your One-Stop Solution for All the Functions in Tableau

Lesson - 3#### Charts in Tableau: Your One-Stop Solution for All the Tableau Charts

Lesson - 4#### What Is Data Blending in Tableau and How To Implement It?

Lesson - 5#### What Are Parameters in Tableau and How to Implement Them

Lesson - 6#### LOD Expressions In Tableau: The All In One Guide

Lesson - 7

Tableau Functions make Tableau stand out in business Analytics proves that Tableau is not just another tool to represent data using pretty looking graphs. Using Tableau Functions, one can understand, analyse, organise, and report data like never before.

This article on "Tableau Functions" is dedicated to walking us through various functions available and used to manipulate data.

The following is the list of Functions in Tableau:

- Number Functions
- String Functions
- Date Functions
- Logical Functions
- Aggregate Functions
- User Functions
- Spatial Functions

In Tableau fields, when the user might need to apply some mathematical operations. In such scenarios, the number functions (one of the Tableau Functions) come handy. The number functions available in Tableau are as follows:

The ABS Tableau Functions are used to Return the absolute value of the given value. The Syntax of the ABS function is as shown below.

ABS(Numerical Value)

ABS(-15) = 15

The ACOS tableau functions are used to return the arc cosine value of the given number. The results are often returned in the measures of Radian. The Syntax of ACOS Function is as follows.

ACOS(Numerical Value)

ACOS(0.5) = 1.04719

The ASIN tableau functions are used to return the arc sine of a given number. The results are often returned in the measures of Radian. The Syntax of the ASIN Function is as follows.

ASIN(Numerical Value)

ASIN(0.5) = 0.5235

The ATAN function in the Tableau is used to return the arc tangent value of a given number. The results are often returned in the measures of Radian. The Syntax of the ATAN Function is as follows.

ATAN(number)

ATAN(180) = 1.565

The ATAN2 Tableau Functions are used to return the arc tangent of two given numbers (x and y). The results are often returned in the measure of radians. The Syntax of the ATAN2 Function is as follows.

ATAN2(x-coordinate, y-coordinate)

ATAN2 (5,3) = 0.4

The CEILING Tableau Functions are used to round up float or double values. The Syntax of the CEILING function is shown below.

CEILING(Numerical Value)

CEILING(2.24) = 3

The COS Tableau Functions are used to find the COSINE value of a given angle. The result is given in the form of Radians. The Syntax of the COS Function is shown below.

COS(Angle Value)

COS(PI()/4 = 0.707)

The COT Tableau Functions are used to return the COTANGENT Value of the given angle. The Syntax of the COT Function is given below

COT(Angle Value)

COT(PI( ) /4) = 1

The DEGREES Function in Tableau is used to find out the value of Radians in its Degrees. The Syntax of the DEGREES Function is shown below.

Syntax:

DEGREES (Radian Value)

DEGREES(PI( )/4) = 45.0

The DIV Function in the Tableau is used to return the integer part of a division operation, in which the first integer is divided by the second integer. The Syntax for the DIV Function is as follows.

DIV (First Integer, Second Integer)

DIV(20,2) = 10

The EXP function is used to find the exponential value of the given number. The Syntax of the EXP function is shown below.

EXP(Numerical Value)

EXP(2) = 7.389

The FLOOR tableau functions are used to round a number to the nearest integer of equal or lesser value. The Syntax of the FLOOR function is shown below.

FLOOR(Numerical Value)

FLOOR(2.234) = 2

The SQUARE function in Tableau is used to find out the SQUARE of the given numerical value. The Syntax of the SQUARE function is shown as follows.

SQUARE(Numerical Value)

SQUARE(6) = 36

The ZN function in Tableau is used for returning the expression if it is not null. Otherwise, it returns zero. Use this function to use zero values in place of null. The Syntax for the ZN function is as follows.

ZN(expression)

ZN(SUM(Sales)) = 23,95,894

Following the numerical functions, we will now move into the next segment to learn the STRING Functions in Tableau.

String Functions (One of the Tableau Functions) are used to manipulate the character type data in Tableau. Following are the String Functions in Tableau.

The LOWER Tableau functions are used to return the given upper case string in the lower case. The Syntax for the LOWER function is shown below.

LOWER(string)

LOWER(TABLEAU) = tableau

The Upper Function is used to return the given lower case string in the upper case. The Syntax for the UPPER function is as follows.

UPPER(string)

UPPER(tableau) = TABLEAU

The ASCII function is used to return the ASCII code for the first character in the String. The Syntax for the ASCII function is shown as follows.

ASCII(String Value)

ASCII(‘A’) = 65

The CHAR function is used to return the character when an ASCII value is passed. The Syntax of the CHAR function is shown below.

CHAR(ASCII Value)

CHAR(65) = ‘A’

The CONTAINS tableau functions are used to find if a certain substring is present in the String. The Syntax of the CONTAINS function is shown below.

CONTAINS(String Value)

CONTAINS(SIMPLILEARN, LEARN)

The ENDSWITH function is used to return a true if the given String ends with the specified substring. ENDSWITH ignores trailing white spaces. The Syntax is shown as follows:

ENDSWITH(string, substring)

ENDSWITH(“Simplilearn”, “earn”) = true

The FIND function is used to return an index position of the substring in a string or null if it is not found. If another argument start is added, the function ignores any substring instances before the index position starts. The beginning character in the string is at index 1. The Syntax for FIND is shown as follows:

FIND(string, substring, [start])

FIND("ABCD", "CD") = 2

The LEFT function is used to return the left-most number of characters in the String. The Syntax of the LEFT function is shown below.

LEFT(String, number)

LEFT("Simplilearn", 5) = "Simpli"

The RIGHT function is used to return the right-most number of characters in the String. The Syntax of the RIGHT function is shown below.

RIGHT(String, number)

RIGHT("Simplilearn", ) = "learn"

The LEN function is implemented to return the length of the given String. The Syntax of the LEN function is given below.

LEN(String Value)

LEN(“Simplilearn”) = 11

The TRIM function is used to return the string with leading and trailing spaces removed. The Syntax of TRIM is shown below.

TRIM(String)

TRIM(" Simplilearn ") = "Simplilearn"

The LTRIM function is used to return the String after removing any leading spaces. The Syntax for the LTRIM function is shown below.

LTRIM(String)

LTRIM(“ Simplilearn ”) = “Simplilearn”

The MAX function is implemented to return the maximum of a and b. The Syntax for the MAX function is as follows.

MAX(a,b)

MAX ("abc","pqrs") = "pqrs"

The MID function is used to return the String starting at the starting position. The initial character in the string is position 1. If another argument length is included, the returned String includes only that number of characters. The Syntax for the MID function is shown below.

(MID(string, start, [length])

MID("Simplilearn", 6) = "learn"

The REPLACE function is used to search the String for the substring and replaces it with the replacement string. The Syntax is shown below.

REPLACE(string, substring, replacement)

REPLACE("Java 8", "8", "13") = "Java 13"

The RTRIM function is used to return a string with any trailing spaces removed. The Syntax of RTRIM is shown below.

RTRIM(string)

RTRIM(" Tableau ") = " Tableau"

The SPACE function is used to return a string composed of the specified number of repeated spaces. The Syntax of the SPACE function is shown below.

SPACE(Number)

SPACE() = " "

The SPLIT function is implemented to return a substring from a string, using a delimiter character to break the string into a tokens sequence. The Syntax of the SPLIT function is shown below.

SPLIT(String, delimiter, token number)

SPLIT (‘a-b-c-d’, ‘-‘, 4) = ‘c

The RETURNSWITH function is used to return true if the String starts with a substring. Leading white spaces are ignored. The Syntax for RETURNSWITH is shown below.

STARTSWITH(string, substring)

STARTSWITH(“Simplilearn”, “Si”) = true

With that, we have finished the String Functions in Tableau. Now, we will continue with USER Functions in Tableau.

The USER-related details and methods are handled by the USER function (One of the Tableau Functions) in real-time. Following is the list of USER functions in Tableau:

The USERNAME function is used to return the name of the current user. The Syntax for USERNAME is shown below.

USERNAME( )

[Manager]=USERNAME( )

The ISUSERNAME is used to return true if the current user's username matches the specified username or false if it does not match. The Syntax for the ISUSERNAME is shown below.

ISUSERNAME(String)

ISUSERNAME("Harry")

The ISMEMEROF function is used to return true if the person currently using Tableau is a group member that matches the given String. The Syntax of the ISMEMBEROF function is mentioned below.

ISMEMBEROF(String)

IF ISMEMBEROF('domain.lan\Annual_Sales') THEN "Annual_Sales" ELSE "Other" END

The USERDOMAIN function is used to return the current user's domain when the user is signed on to Tableau Server. The Syntax for the USERDOMAIN function is shown below.

USERDOMAIN()

[Manager]=USERNAME() AND [Domain]=USERDOMAIN()

The FULLNAME function is used to returns the full name for the current user. The Syntax for FULLNAME is shown below.

FULLNAME( )

[Manager]=FULLNAME( )

The ISFULLNAME function is used to return true if the present user's name gets a match to the specified full name or false if it does not match. The Syntax for ISFULLNAME function is shown below.

ISFULLNAME(String)

ISFULLNAME("Charles")

With that, we have finished User Functions. Moving ahead, we will learn Logical Functions.

The Logical operations on the Data in Tableau are handled by the Logical Functions(One of the Tableau Functions). Following is the list of logical functions in Tableau.

The IF function is implemented to test a series of expressions returning the <then> value for the first true <expr>. The Syntax for the IF function is shown below.

IF <expr> THEN <then> [ELSEIF <expr2> THEN <then2> statement ] [ELSE <else>] END

The ELSE function is used to test a series of expressions returning the <then> value for the first true <expr>. The Synta for the ELSE function is shown below.

IF <expr> THEN <then> ELSE <else> END

The ELSEIF function is used to test a series of expressions returning the <then> value for the first true <expr>. The Syntax for the ELSEIF function is shown below.

IF <expr> THEN <then> [ELSEIF <expr2> THEN <then2>...] [ELSE <else>] END

The CASE function is used to perform logical tests and returns appropriate values. The CASE function evaluates an expression, compares it to a sequence of values, value1, value2, etc., and returns a result. The Syntax of the CASE function is shown below.

CASE <expression> WHEN <value1> THEN <return1> WHEN <value2> THEN <return2> ... ELSE <default return> END

The AND function is used to perform logical conjunction between two expressions. The Syntax for AND function is as follows.

IF <expr1> AND <expr2> THEN <then> END

The OR function is used to perform a disjunction operation between two expressions. The Syntax for the OR function is shown as follows.

IF <expr1> OR <expr2> THEN <then> END

The NOT function is used to find the logical negation of a given expression. The Syntax for the NOT function is as follows.

IF NOT <expr> THEN <then> END

The THEN function is used to test a series of expressions returning the <then> value for the first true <expr>. The Syntax of the THEN function is shown below.

IF <expre> THEN <then> [ELSEIF ,expr2> THEN <then2>...] [ELSE <else>] END

The WHEN function is used to find the first <value> that matches <expr> and returns the corresponding <return>. The Syntax for the WHEN function is shown below.

CASE <expr> WHEN <Value1> THEN <return1> ... [ELSE <else>] END

The END function is used to test a series of expressions returning the <then> value for the first true <expr>. Must be placed at the end of an expression. The Syntax for the END function is shown below.

IF <expr> THEN <then> [ELSEIF <expr2> THEN <then2>...] [ELSE <else>] END

With that, we have finished Logical Functions. Moving ahead, we will learn about Aggregate Functions.

The Mathematical computations in Tableau are handled by Aggregate Functions. Following is the list of Aggregate functions in Tableau:

The VAR function is used to return all values' statistical variances in the given expression based on a population sample.

VAR(expression)

The VARP function is used to return all values' statistical variance in the entire population's given expression.

VARP(expression)

The SUM function is implemented to return the sum of all values in the expression. The numeric fields use the SUM function by ignoring the Null values. The Syntax to SUM function is shown below.

SUM(Expression)

The STDEV function is used to return the statistical standard deviation of all values in the given expression based on a population sample. The Syntax of the STDEV function is written below.

STDEV(expression)

The STDEVP function is used to return the statistical standard deviation of all values in the given expression based on a biased population. The Syntax of the STDEVP function is written below.

STDEVP(expression)

The Percentile function is used to return the percentile value from the given expression corresponding to the specified number. The Syntax of the PERCENTILE function is shown below.

PERCENTILE(expression, number)

The MIN function is implemented to return the minimum of an expression across all records. The Syntax of the MIN function is shown below.

MIN(expression)

The MEDIAN function is implemented to return the median of an expression across all records. The Syntax of the MEDIAN function is shown below.

MEDIAN(Expression)

The MAX function is implemented to return the maximum of an expression across all records. The Syntax of the MAX function is shown below.

MAX(EXPRESSION)

The COVARP function is used to return the population covariance of two expressions. The Syntax of the COVARP function is shown below.

COVARP(expression 1, expression2)

The COUNT function is implemented to return the number of items in a group. Null values are not ignored. The Syntax for the COUNT function is shown below.

COUNT(Expression)

The COUNTD function is used to return the number of distinct items in a group. The Syntax for the COUNTD function is shown below.

COUNTD(expression)

The CORR function is used to return the Pearson correlation coefficient of two expressions. The Syntax for the CORR function is written below.

CORR(expression a, expression b)

The COLLECT function is used to combine the values in the argument field and ignoring the Null values. The Syntax for the COLLECT function is shown below.

COLLECT (spatial)

The AVG function is implemented to return the average of all the values in the expression. The Syntax for the AVG function is shown below.

AVG(Expression)

The ATTR function is used to return the expression's value if it has a single value for all rows. The Syntax for the ATTR function is shown below.

ATTR(expression)

With that, we have reached the next segment, where we will learn the Spatial Functions.

We execute advanced Spatial Analytics in Tableau using the Spatial Functions in Tableau. The following is the list of Spatial Functions in Tableau

The DISTANCE function is used to return distance measurement between two points in a specified unit. The Syntax for the DISTANCE function is shown below.

DISTANCE(<geometry1>,<geometry2>,"<units>")

DISTANCE([Origin MakePoint],[Destination MakePoint], "km")

The MAKELINE function is used to generate a line mark between two points, useful for building origin-destination maps. The Syntax for the MAKELINE function is shown below.

MAKELINE(<geometry1>,<geometry2>)

MAKELINE(Origin, Destination)

The MAKEPOINT function is used to convert data from latitude and longitude columns into spatial objects. The Syntax for MAKEPOINT function is shown below.

MAKEPOINT(<latitude>, <longitude>)

MAKEPOINT([SeaportLatitude],[SeaportLongitude])

The MAKEPOINT(X, Y, SRID) function is used to convert data from projected geographic coordinates into spatial objects. SRID is a spatial reference identifier that uses ESPG reference system codes to specify coordinate systems. The Syntax for MAKEPOINT(X, Y, SIRD) is mentioned below.

Syntax:

MAKEPOINT(<xcoordinate>, <ycoordinate>, <SRID>

Example:

MAKEPOINT([Xcoord],[Ycoord],2211)

So with that, we have reached the end of this "Tableau Functions: Your One-Stop solution for all the functions in Tableau," article.

Get broad exposure to key technologies and skills used in data analytics and data science, including statistics with the Post Graduate Program in Data Analytics.

Tableau Charts can be your next stop. Tableau Charts will help you represent your data in a user-friendly and readable way.

The link to your next stage is here, Tableau Charts.

Suppose you are looking to enhance your skills and gain in-depth knowledge about Tableau Software to become certified as a Business Intelligence Professional. Feel free to explore Simplilearn's Tableau training and certification program. Designed by experts and delivered by practitioners, this program could be what you are looking forward to learning.

If you have any questions about this "Tableau Functions: Your One-Stop solution for all the functions in Tableau" article, please leave them in the comments section towards the end of this article, and our expert team will answer them; for you at the earliest!

Ravikiran A S works with Simplilearn as a Research Analyst. He an enthusiastic geek always in the hunt to learn the latest technologies. He is proficient with Java Programming Language, Big Data, and powerful Big Data Frameworks like Apache Hadoop and Apache Spark.

prevNext

- Disclaimer
- PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.