Tableau provides various Math and Trigonometric Functions to perform mathematical operations on our data. They are Tableau FLOOR, CEILING, ABS, DIV, POWER, SQRT, SQUARE, MIN, MAX, SIN, COS, TAN, ACOS, ASIN, ATAN, ATAN2, LN, LOG, etc. In this article, we show how to use Tableau Math Functions with examples.
To demonstrate these Tableau Math Functions, we are going to use the below-shown data. As you can see, there are nine records in this table.
Remember, this is an Excel Worksheet. So, Please refer Connecting to the Excel Files article to understand the connection settings.
Tableau Math Functions
The following examples will show you the list of Math Functions in Tableau
Tableau ABS Function
The Tableau ABS function is used to return the absolute positive value. Syntax of this Tableau ABS Function is:
ABS(number)
To demonstrate these Tableau math functions, we use Calculated Fields. To create a calculated field, navigate to Analysis Tab, and select Create Calculated Field… option.
Once you click on the Create Calculated Field… option, the following window will open. Here, we renamed the default calculation name as ABS.
Below statement will find the Absolute values of Service Grade
ABS([Service Grade])
Let me add this Tableau ABS function field to an existing table (by dragging a field to Measures Shelf). Please refer Create Table Report article to understand the process of creating a table
Tableau ACOS Function
The Tableau ACOS function calculates the Arc cosine of a given number. The syntax of this Tableau ACOS Function is:
ACOS(Number)
The below Tableau ACOS statement will find the ArcCosine of Service Grade
ACOS([Service Grade])
Tableau ASIN Function
Tableau ASIN function will calculate the Arc sine of a given number. The syntax of this Tableau ASIN Function is:
ASIN(Number)
The following statement finds the Arcsine of Service Grade
ASIN([Service Grade])
Tableau ATAN Function
Tableau ATAN function is used to calculate the Arc Tangent of a given number. The syntax of this Tableau ATAN Function is:
ATAN(Number)
Below statement will find the Arc Tangent of Service Grade
ATAN([Service Grade])
Tableau SIN Function
Tableau SIN function is used to calculate the Sine value. The syntax of this Tableau SIN Function is:
SIN(Number)
It will find the Sine value of Service Grade
SIN([Service Grade])
Tableau TAN Function
Tableau TAN function is to calculate the Tangent value. The syntax of this Tableau TAN Function is:
TAN(Number)
Below statement will find the Tangent value of Service Grade
TAN([Service Grade])
Let me add this TAN field to Measures shelf
Tableau COS Function
Tableau COS function will calculate the Cosine value. The syntax of this Tableau COS Function is:
COS(Number)
It will find Cosine value of Service Grade
COS([Service Grade])
Tableau ATAN2 Function
Tableau ATAN2 function is to calculate arc Tangent of two given numbers. The syntax of this Tableau ATAN2 Function is:
ATAN2(y_number, x_number)
Below statement will find the Arc Tangent value of Sales amount and Standard cost
ATAN2([Standard Cost], [Sales Amount])
Tableau COT Function
Tableau COT function will calculate the Cotangent value. The syntax of this Tableau COT Function is:
COT(Number)
It will find Cotangent value of Service Grade
COT([Service Grade])
Tableau DEGREES Function
Tableau Degrees function will convert Radians to Degrees. The syntax of this Tableau Degrees Function is:
DEGREES(Number)
It will convert the Radiant value in Service Grade to degrees
DEGREES([Service Grade])
Let me add this Degrees field to Measures shelf
Tableau RADIANS Function
The Tableau RADIANS function will convert Degrees to Radians. The syntax of this Tableau Radians Function is:
RADIANS(Number)
It will convert the degrees value in Sales Amount to Radians
RADIANS([Service Grade])
Let me add this Radians field to Measures shelf
Tableau EXP Function
The Tableau EXP function returns e raised to the power of the user-specified number. The syntax of this Tableau EXP Function is:
EXP(Number)
It finds e power service grade
EXP([Service Grade])
Let me add this Tableau EXP field to Measures shelf
Tableau SQUARE Function
The Tableau Square function finds the square of a given number. The syntax of this Tableau Square Function is:
SQUARE(Number)
It will find out the square of the tax amount
SQUARE([Tax Amt])
Let me add this SQUARE field to Measures shelf
Tableau SQRT Function
The Tableau Sqrt function finds the square root of a given number. The syntax of this Tableau Sqrt Function is:
SQRT(Number)
It will find the square root of Sales amount
SQRT([Sales Amount])
Let me add this SQRT field to Measures shelf
Tableau ROUND Function
The Tableau Round function returns the nearest integer value. It accepts the second argument (optional) to specify the number of decimals. The syntax of this Tableau Round Function is:
ROUND(Number, no_of_decimals)
For example,
- ROUND(248.6759) = 249
- ROUND(248.6759, 1 ) = 248.7
- ROUND(248.6759, 2 ) = 248.68
Below statement will round the Standard Cost values to the nearest integer
ROUND([Standard Cost])
Let me add this ROUND field to Measures shelf
Tableau CEILING Function
The Tableau Ceiling function returns the closest integer value, which is greater than or equal to a given value. The syntax of this Tableau Ceiling Function is:
CEILING(Number)
Below statement will find the closest integer value which is greater than or equal to Standard Cost
CEILING([Standard Cost])
Let me add this CEILING field to Measures shelf
Tableau FLOOR Function
The Tableau Floor function is used to return the closest integer value, which is less than or equal to a given value. The syntax of this Tableau Floor Function is:
FLOOR(Number)
The below Tableau Floor statement will find the closest integer value which is less than or equal to Standard Cost
FLOOR([Standard Cost])
Tableau SIGN Function
The Tableau Sign function is handy to find the integer Sign, This function return
- +1 = Positive Value
- -1 = Negative values
- 0 = for zeros.
The syntax of this Tableau Sign Function is:
SIGN(Number)
Tableau Sign function will find the sign of a Service Grade records
SIGN([Service Grade])
Tableau PI Function
The Tableau PI function returns numeric value 3.14, and the syntax is:
PI()
It will divide the PI value, i.e., 3.14 with Service Grade values. Let me add this Tableau PI field to Measures shelf
PI() / [Service Grade]
Tableau POWER Function
The Tableau Power function is used to find the Power of a given number. Use the second argument to specify the Power.
For example Power(2, 3) = 2³. The syntax of this Tableau Power Function is:
POWER(Number, power)
It will find the Sales Amount raised to the power of 2
POWER([Sales Amount], 2)
Let me add this Tableau Power field to Measures shelf
Tableau LN Function
The Tableau LN function is used to find the natural logarithmic value of a given number. The syntax of this Tableau LN Function is:
LN(Number)
It will find the natural logarithmic value of Sales Amount
LN([Sales Amount])
Tableau LOG Function
The Tableau LOG function is used to find the logarithmic value of a given number for a specified base. Here, the second argument is optional, and its default value is 10. The syntax of this Tableau LOG Function is:
LOG(Number, base)
It will find the logarithmic value of Sales Amount for base 5
LOG([Sales Amount], 5)
Let me add this Tableau LOG field to Measures shelf
Tableau DIV Function
The Tableau DIV function divides one number by another. The syntax of this Tableau DIV Function is:
DIV(integer, integer)
The following Tableau DIV statement divides Sales Amount by 5
DIV(INT([Sales Amount]), 5)