Number Functions
This article introduces number functions and their uses in Tableau. It also demonstrates how to create a number calculation using an example.
In this article
Why use number functions
Number functions allow you to perform computations on the data values in your fields. Number functions can only be used with fields that contain numerical values. For more information, see Data Types.
For example, you might have a field that contains values for the variance in your budget, titled Budget Variance. One of those values might be 7. You can use the ABS function to return the absolute value of that number, and all the other numbers in that field.
The calculation might look something like this:
ABS[Budget Variance]
Therefore, ABS(7) = 7.
Number functions available in Tableau
Function 
Syntax 
Description 

ABS 

Returns the absolute value of the given number. Examples:
The second example returns
the absolute value for all the numbers contained in the 

ACOS 

Returns the arc cosine of the given number. The result is in radians. Example:


ASIN 

Returns the arc sine of a given number. The result is in radians. Example:


ATAN 
ATAN(number)

Returns the arc tangent of a given number. The result is in radians. Example:


ATAN2 

Returns the arc tangent of two given numbers (x and y). The result is in radians. Example:


CEILING 



COS 

Returns the cosine of an angle. Specify the angle in radians. Example:


COT 

Returns the cotangent of an angle. Specify the angle in radians. Example:


DEGREES 

Converts a given number in radians to degrees. Example:


DIV 
DIV(integer1, integer2) 
Returns the integer part of a division operation, in which integer1 is divided by integer2. Example:


EXP 

Returns e raised to the power of the given number. Examples:


FLOOR 



HEXBINX 

Maps an x, y coordinate to the xcoordinate of the nearest hexagonal bin. The bins have side length 1, so the inputs may need to be scaled appropriately. HEXBINX and HEXBINY are binning and plotting functions for hexagonal bins. Hexagonal bins are an efficient and elegant option for visualizing data in an x/y plane such as a map. Because the bins are hexagonal, each bin closely approximates a circle and minimizes variation in the distance from the data point to the center of the bin. This makes the clustering both more accurate and informative. Example:


HEXBINY 

Maps an x, y coordinate to the ycoordinate of the nearest hexagonal bin. The bins have side length 1, so the inputs may need to be scaled appropriately. Example:


LN 

Returns the natural logarithm
of a number. Returns 

LOG 

Returns the logarithm of a number for the given base. If the base value is omitted, base 10 is used. 

MAX 

Returns the maximum
of the two arguments, which must be of the same type. Returns Examples:


MIN 

Returns the minimum
of the two arguments, which must be of the same type. Returns Examples:


PI 

Returns the numeric constant pi: 3.14159. 

POWER 

Raises the number to the specified power. Examples:
You can also use the ^ symbol:


RADIANS 

Converts the given number from degrees to radians. Example:


ROUND 

Rounds numbers
to a specified number of digits. The Example: This example rounds
every
Some databases, such as SQL Server, allow specification of a negative 

SIGN 

Returns the sign of a number: The possible return values are 1 if the number is negative, 0 if the number is zero, or 1 if the number is positive. Example: If the average of the profit field is negative, then


SIN 

Returns the sine of an angle. Specify the angle in radians. Examples:


SQRT 

Returns the square root of a number. Example:


SQUARE 

Returns the square of a number. Example:


TAN 

Returns the tangent of an angle. Specify the angle in radians.. Example:


ZN 

Returns the expression if it is not null, otherwise returns zero. Use this function to use zero values instead of null values. Example:

Create a number calculation
Follow along with the steps below to learn how to create a number calculation.

In Tableau Desktop, connect to the Sample  Superstore saved data source, which comes with Tableau.

Navigate to a worksheet and select Analysis > Create Calculated Field.

In the calculation editor that opens, do the following:

Name the calculated field Minimum Sales transaction

Enter the following formula:
MIN(Sales)

When finished, click OK.
The new number calculation appears under Measures in the Data pane. Just like your other fields, you can use it in one or more visualizations.
When Minimum Sales is placed on Text on the Marks card in the worksheet, its name is changed to AGG(Minimum Sales), which indicates that it cannot be aggregated any further, since it is already aggregated down to the lowest level of detail (the smallest sales value for all records).
This example shows the minimum sales per category.
When subcategory is brought into the view, the minimum sales for each subcategory are shown.
See Also
Tableau Functions (Alphabetical)
Tableau Functions (by Category)
Formatting Calculations in Tableau