---
schema_version: "1"
id: a664d03e989404f79a5027c6bc8a0a0d4b7b607755117a92b9a9f6fb5d9547cf
title: Number Functions
collection: tableau
version: next
locale: en-gb
portal_url: https://docs.salesforce.com/tableau/next/en-gb/public/desktop/functions_functions_number.md
canonical_url: https://help.tableau.com/v0.0/public/desktop/en-gb/functions_functions_number.htm
source_site: help.tableau.com
content_type: documentation
content_hash: a8431b3cc67310c8e14342bddcfbcd1706e6a74d7689a4d74a452a47099e36c4
description: Reference for Tableau number functions used in calculations.
---
[Skip to main content](#main-content)

# Number Functions

This article introduces number functions and their uses in Tableau. It also demonstrates how to create a number calculation using an example.

## 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](https://help.tableau.com/v0.0/public/desktop/en-gb/datafields_typesandroles_datatypes.htm).

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]`

And for that -7 value, the output would be 7.

## Number functions available in Tableau

### ABS

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>ABS(number)</code></td></tr><tr><td>Output</td><td>Number (positive)</td></tr><tr><td>Definition</td><td>Returns the absolute value of the given <code>&lt;number&gt;</code>.</td></tr><tr><td>Example</td><td><pre>ABS(-7) = 7<br>ABS([Budget Variance])</pre><p>The second example returns the absolute value for all the numbers contained in the Budget Variance field.</p></td></tr><tr><td>Notes</td><td>See also <code><a href="#SIGN" class="xref">SIGN</a></code>.</td></tr></tbody></table>

### ACOS

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>ACOS(number)</code></td></tr><tr><td>Output</td><td>Number (angle in radians)</td></tr><tr><td>Definition</td><td>Returns the arccosine (angle) of the given <code>&lt;number&gt;</code>.</td></tr><tr><td>Example</td><td><pre>ACOS(-1) = 3.14159265358979</pre></td></tr><tr><td>Notes</td><td>The inverse function, <code><a href="#COS" class="xref">COS</a></code>, takes the angle in radians as the argument and returns the cosine.</td></tr></tbody></table>

### ASIN

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>ASIN(number)</code></td></tr><tr><td>Output</td><td>Number (angle in radians)</td></tr><tr><td>Definition</td><td>Returns the arcsine (angle) of a given <code>&lt;number&gt;</code>.</td></tr><tr><td>Example</td><td><pre>ASIN(1) = 1.5707963267949</pre></td></tr><tr><td>Notes</td><td>The inverse function, <code><a href="#SIN" class="xref">SIN</a></code>, takes the angle in radians as the argument and returns the sine.</td></tr></tbody></table>

### ATAN

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>ATAN(number)</code></td></tr><tr><td>Output</td><td>Number (angle in radians)</td></tr><tr><td>Definition</td><td>Returns the arctangent (angle) of a given <code>&lt;number&gt;</code>.</td></tr><tr><td>Example</td><td><pre>ATAN(180) = 1.5652408283942</pre></td></tr><tr><td>Notes</td><td><p>The inverse function, <code>TAN</code>, takes the angle in radians as the argument and returns the tangent.</p><p>See also <code><a href="#ATAN2" class="xref">ATAN2</a></code> and <code><a href="#COT" class="xref">COT</a></code>.</p></td></tr></tbody></table>

### ATAN2

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>ATAN2(y number, x number)</code></td></tr><tr><td>Output</td><td>Number (angle in radians)</td></tr><tr><td>Definition</td><td>Returns the arctangent (angle) between two numbers (x and y). The result is in radians.</td></tr><tr><td>Example</td><td><pre>ATAN2(2, 1) = 1.10714871779409</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#ATAN" class="xref">ATAN</a></code>, <code><a href="#TAN" class="xref">TAN</a></code> and <code><a href="#COT" class="xref">COT</a></code>.</td></tr></tbody></table>

### CEILING

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>CEILING(number)</code></td></tr><tr><td>Output</td><td>Integer</td></tr><tr><td>Definition</td><td>Rounds a <code>&lt;number&gt;</code> to the nearest integer of equal or greater value.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">CEILING(2.1) = 3</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#FLOOR" class="xref">FLOOR</a></code> and <code><a href="#ROUND" class="xref">ROUND</a></code>.</td></tr><tr><td>Database limitations</td><td><p><code>CEILING</code> is available through the following connectors: Microsoft Excel, Text File, Statistical File, Published Data Source, Amazon EMR Hadoop Hive, Amazon Redshift, Cloudera Hadoop, DataStax Enterprise, Google Analytics, Google BigQuery, Hortonworks Hadoop Hive, MapR&nbsp;Hadoop Hive, Microsoft SQL&nbsp;Server, Salesforce, Spark&nbsp;SQL.</p></td></tr></tbody></table>

### COS

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>COS(number)</code><p>The number argument is the angle in radians.</p></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Returns the cosine of an angle.</td></tr><tr><td>Example</td><td><pre>COS(PI( ) /4) = 0.707106781186548</pre></td></tr><tr><td>Notes</td><td><p>The inverse function, <code><a href="#ACOS" class="xref">ACOS</a></code>, takes the cosine as the argument and returns the angle in radians.</p><p>See also <code><a href="#PI" class="xref">PI</a></code>. To convert an angle from degrees to radians, use <code><a href="#RADIANS" class="xref">RADIANS</a></code>.</p></td></tr></tbody></table>

### COT

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>COT(number)</code><p>The number argument is the angle in radians.</p></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Returns the cotangent of an angle.</td></tr><tr><td>Example</td><td><pre>COT(PI( ) /4) = 1</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#ATAN" class="xref">ATAN</a></code>, <code><a href="#TAN" class="xref">TAN</a></code> and <code><a href="#PI" class="xref">PI</a></code>. To convert an angle from degrees to radians, use <code><a href="#RADIANS" class="xref">RADIANS</a></code>.</td></tr></tbody></table>

### DEGREES

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>DEGREES(number)</code><p>The number argument is the angle in radians.</p></td></tr><tr><td>Output</td><td>Number (degrees)</td></tr><tr><td>Definition</td><td>Converts an angle in radians to degrees.</td></tr><tr><td>Example</td><td><pre>DEGREES(PI( )/4) = 45.0</pre></td></tr><tr><td>Notes</td><td><p>The inverse function, <code><a href="#RADIANS" class="xref">RADIANS</a></code>, takes an angle in degrees and returns the angle in radians.</p><p>See also <code><a href="#PI" class="xref">PI</a>()</code>.</p></td></tr></tbody></table>

### DIV

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>DIV(integer1, integer2)</code></td></tr><tr><td>Output</td><td>Integer</td></tr><tr><td>Definition</td><td>Returns the integer part of a division operation, in which <code>&lt;integer1&gt;</code> is divided by <code>&lt;integer2&gt;</code>.</td></tr><tr><td>Example</td><td><pre>DIV(11,2) = 5</pre></td></tr></tbody></table>

### EXP

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>EXP(number)</code></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Returns e raised to the power of the given <code>&lt;number&gt;</code>.</td></tr><tr><td>Example</td><td><pre>EXP(2) = 7.389<br>EXP(-[Growth Rate]*[Time])</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#LN" class="xref">LN</a></code>.</td></tr></tbody></table>

### FLOOR

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>FLOOR(number)</code></td></tr><tr><td>Output</td><td>Integer</td></tr><tr><td>Definition</td><td>Rounds a number to the nearest <code>&lt;number&gt;</code> of equal or lesser value.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">FLOOR(7.9) = 7</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#CEILING" class="xref">CEILING</a></code> and <code><a href="#ROUND" class="xref">ROUND</a></code>.</td></tr><tr><td>Database limitations</td><td><p><code>FLOOR</code> is available through the following connectors: Microsoft Excel, Text File, Statistical File, Published Data Source, Amazon EMR Hadoop Hive, Cloudera Hadoop, DataStax Enterprise, Google Analytics, Google BigQuery, Hortonworks Hadoop Hive, MapR&nbsp;Hadoop Hive, Microsoft SQL&nbsp;Server, Salesforce, Spark&nbsp;SQL.</p></td></tr></tbody></table>

### HEXBINX

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>HEXBINX(number, number)</code></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Maps an x, y coordinate to the x-coordinate of the nearest hexagonal bin. The bins have side length 1, so the inputs may need to be scaled appropriately.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">HEXBINX([Longitude]*2.5, [Latitude]*2.5)</pre></td></tr><tr><td>Notes</td><td><code>HEXBINX </code>and <code><a href="#HEXBINY" class="xref">HEXBINY</a></code> are binning and plotting functions for hexagonal bins. Hexagonal bins are an efficient and elegant option for visualising data in an x/y plane such as a map. Because the bins are hexagonal, each bin closely approximates a circle and minimises variation in the distance from the data point to the centre of the bin. This makes the clustering both more accurate and informative.</td></tr></tbody></table>

### HEXBINY

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>HEXBINY(number, number)</code></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Maps an x, y coordinate to the y-coordinate of the nearest hexagonal bin. The bins have side length 1, so the inputs may need to be scaled appropriately.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">HEXBINY([Longitude]*2.5, [Latitude]*2.5)</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#HEXBINX" class="xref">HEXBINX</a></code>.</td></tr></tbody></table>

### LN

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>LN(number)</code></td></tr><tr><td>Output</td><td><p>Number</p><p>The output is <code>Null</code> if the argument is less than or equal to zero.</p></td></tr><tr><td>Definition</td><td>Returns the natural logarithm of a <code>&lt;number&gt;</code>.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">LN(50) = 3.912023005</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#EXP" class="xref">EXP</a></code> and <code><a href="#LOG" class="xref">LOG</a></code>.</td></tr></tbody></table>

### LOG

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>LOG(number, [base])</code><p>If the optional base argument isn't present, base 10 is used.</p></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Returns the logarithm of a number for the given base.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">LOG(16,4) = 2</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#POWER" class="xref">POWER</a></code> <code><a href="#LN" class="xref">LN</a></code>.</td></tr></tbody></table>

### MAX

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>MAX(expression)</code> or <code>MAX(expr1, expr2)</code></td></tr><tr><td>Output</td><td>Same data type as the argument, or <code>NULL&nbsp;</code>if any part of the argument is null.</td></tr><tr><td>Definition</td><td><p>Returns the maximum of the two arguments, which must be of the same data type.</p><p><code>MAX</code> can also be applied to a single field as an aggregation.</p></td></tr><tr><td>Example</td><td><pre xml:space="preserve">MAX(4,7) = 7<br>MAX(#3/25/1986#, #2/20/2021#) = #2/20/2021# <br>MAX([Name]) = "Zander"</pre></td></tr><tr><td>Notes</td><td><p><b>For strings</b></p><p><code>MAX</code> is usually the value that comes last in alphabetical order.</p><p class="note">For database data sources, the <code>MAX</code> string value is highest in the sort sequence defined by the database for that column.</p><p><b>For dates</b></p><p>For dates, the <code>MAX</code> is the most recent date. If <code>MAX</code> is an aggregation, the result will not have a date hierarchy. If <code>MAX</code> is a comparison, the result will retain the date hierarchy.</p><p><b>As an aggregation</b></p><p><code>MAX(expression)</code> is an aggregate function and returns a single aggregated result. This displays as <code>AGG(expression)</code> in the viz.</p><p><b>As a comparison</b></p><p><code>MAX(expr1, expr2)</code> compares the two values and returns a row-level value.</p><p>See also <code><a href="#MIN" class="xref">MIN</a></code>.</p></td></tr></tbody></table>

### MIN

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>MIN(expression)</code> or <code>MIN(expr1, expr2)</code></td></tr><tr><td>Output</td><td>Same data type as the argument, or <code>NULL&nbsp;</code>if any part of the argument is null.</td></tr><tr><td>Definition</td><td><p>Returns the minimum of the two arguments, which must be of the same data type.</p><p><code>MIN </code>can also be applied to a single field as an aggregation.</p></td></tr><tr><td>Example</td><td><pre xml:space="preserve">MIN(4,7) = 4<br>MIN(#3/25/1986#, #2/20/2021#) = #3/25/1986#<br>MIN([Name]) = "Abebi"</pre></td></tr><tr><td>Notes</td><td><p><b>For strings</b></p><p><code>MIN</code> is usually the value that comes first in alphabetical order.</p><p class="note">For database data sources, the <code>MIN</code> string value is lowest in the sort sequence defined by the database for that column.</p><p><b>For dates</b></p><p>For dates, the <code>MIN</code> is the earliest date. If <code>MIN</code> is an aggregation, the result will not have a date hierarchy. If <code>MIN</code> is a comparison, the result will retain the date hierarchy.</p><p><b>As an aggregation</b></p><p><code>MIN(expression)</code> is an aggregate function and returns a single aggregated result. This displays as <code>AGG(expression)</code> in the viz.</p><p><b>As a comparison</b></p><p><code>MIN(expr1, expr2)</code> compares the two values and returns a row-level value.</p><p>See also <code><a href="#MAX" class="xref">MAX</a></code>.</p></td></tr></tbody></table>

### PI

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>PI()</code></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Returns the numeric constant pi: 3.14159...</td></tr><tr><td>Example</td><td><pre xml:space="preserve">PI()&nbsp;= 3.14159</pre></td></tr><tr><td>Notes</td><td>Useful for trig functions that take their input in radians. See also <code><a href="#RADIANS" class="xref">RADIANS</a></code>.</td></tr></tbody></table>

### POWER

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>POWER(number, power)</code></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Raises the <code>&lt;number&gt;</code> to the specified <code>&lt;power&gt;</code>.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">POWER(5,3) = 125<br>POWER([Temperature], 2)</pre></td></tr><tr><td>Notes</td><td>You can also use the ^ symbol, such as <code>5^3 = POWER(5,3) = 125</code><p>See also <code><a href="#EXP" class="xref">EXP</a></code>, <code><a href="#LOG" class="xref">LOG</a></code> and <code><a href="#SQUARE" class="xref">SQUARE</a></code>.</p></td></tr></tbody></table>

### RADIANS

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>RADIANS(number)</code></td></tr><tr><td>Output</td><td>Number (angle in radians)</td></tr><tr><td>Definition</td><td>Converts the given <code>&lt;number&gt;</code> from degrees to radians.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">RADIANS(180) = 3.14159</pre></td></tr><tr><td>Notes</td><td>The inverse function, <code><a href="#DEGREES" class="xref">DEGREES</a></code>, takes an angle in radians and returns the angle in degrees.</td></tr></tbody></table>

### ROUND

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>ROUND(number, [decimals])</code></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td><p>Rounds <code>&lt;number&gt;</code> to a specified number of digits.</p><p>The optional <code>decimals</code> argument specifies how many decimal points of precision to include in the final result. If <code>decimals</code> is omitted, number is rounded to the nearest integer.</p></td></tr><tr><td>Example</td><td><pre xml:space="preserve">ROUND(1/3, 2) = 0.33</pre></td></tr><tr><td>Notes</td><td><p>Some databases, such as SQL Server, allow specification of a negative length, where -1 rounds number to 10s, -2 rounds to 100s and so on. This is not true of all databases. For example, it is not true of Excel or Access.</p><blockquote><p>[!TIP]</p><p>Because <code>ROUND</code> may run into issues due to the underlying floating point representation of numbers – such as 9.405 rounding to 9.40 – it may be preferable to <a href="https://help.tableau.com/current/pro/desktop/en-gb/formatting_specific_numbers.htm">format the number</a> to the desired number of decimal points rather than rounding. Formatting 9.405 to two decimal places will yield the expected 9.41.</p></blockquote><p>See also <code><a href="#CEILING" class="xref">CEILING</a></code> and <code><a href="#FLOOR" class="xref">FLOOR</a></code>.</p></td></tr></tbody></table>

### SIGN

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>SIGN(number)</code></td></tr><tr><td>Output</td><td>-1, 0 or 1</td></tr><tr><td>Definition</td><td>Returns the sign of a <code>&lt;number&gt;</code>: The possible return values are -1 if the number is negative, 0 if the number is zero or 1 if the number is positive.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">SIGN(AVG(Profit)) = -1</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#ABS" class="xref">ABS</a></code>.</td></tr></tbody></table>

### SIN

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>SIN(number)</code><p>The number argument is the angle in radians.</p></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Returns the sine of an angle.</td></tr><tr><td>Example</td><td><pre>SIN(0) = 1.0<br>SIN(PI( )/4) = 0.707106781186548</pre></td></tr><tr><td>Notes</td><td><p>The inverse function, <code><a href="#ASIN" class="xref">ASIN</a></code>, takes the sine as the argument and returns the angle in radians.</p><p>See also <code><a href="#PI" class="xref">PI</a></code>. To convert an angle from degrees to radians, use <code><a href="#RADIANS" class="xref">RADIANS</a></code>.</p></td></tr></tbody></table>

### SQRT

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>SQRT(number)</code></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Returns the square root of a <code>&lt;number&gt;</code>.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">SQRT(25) = 5</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#SQUARE" class="xref">SQUARE</a></code>.</td></tr></tbody></table>

### SQUARE

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>SQUARE(number)</code></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Returns the square of a <code>&lt;number&gt;</code>.</td></tr><tr><td>Example</td><td><pre xml:space="preserve">SQUARE(5) = 25</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#SQRT" class="xref">SQRT</a></code> and <code><a href="#POWER" class="xref">POWER</a></code>.</td></tr></tbody></table>

### TAN

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>TAN(number)</code><p>The number argument is the angle in radians.</p></td></tr><tr><td>Output</td><td>Number</td></tr><tr><td>Definition</td><td>Returns the tangent of an angle.</td></tr><tr><td>Example</td><td><pre>TAN(PI ( )/4) = 1.0</pre></td></tr><tr><td>Notes</td><td>See also <code><a href="#ATAN" class="xref">ATAN</a></code>, <code><a href="#ATAN2" class="xref">ATAN2</a></code>, <code><a href="#COT" class="xref">COT</a></code> and <code><a href="#PI" class="xref">PI</a></code>. To convert an angle from degrees to radians, use <code><a href="#RADIANS" class="xref">RADIANS</a></code>.</td></tr></tbody></table>

### ZN

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>ZN(expression)</code></td></tr><tr><td>Output</td><td>Any, or o</td></tr><tr><td>Definition</td><td><p>Returns the <code>&lt;expression&gt;</code> if it is not null, otherwise returns zero.</p><p>Use this function to replace null values with zeros.</p></td></tr><tr><td>Example</td><td><pre xml:space="preserve">ZN(Grade) = 0</pre></td></tr><tr><td>Notes</td><td>This is a very useful function when using fields that may contain nulls in a calculation. Wrapping the field with <code>ZN</code> can prevent errors caused by calculating with nulls.</td></tr></tbody></table>  

## Create a number calculation

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

1. In Tableau Desktop, connect to the **Sample - Superstore** saved data source, which comes with Tableau.
2. Navigate to a worksheet and select Analysis \> Create Calculated Field.
3. 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 visualisations.

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.

![A table displaying categories and their associated values.](/tableau/next/en-gb/public/desktop/en-gb/Img/number_function1.png)

When subcategory is brought into the view, the minimum sales for each subcategory are shown.

![A table displaying the quantity of items within different categories and subcategories.](/tableau/next/en-gb/public/desktop/en-gb/Img/number_function2.png)

## See Also

[Functions in Tableau](https://help.tableau.com/v0.0/public/desktop/en-gb/functions.htm)

[Tableau Functions (Alphabetical)](https://help.tableau.com/v0.0/public/desktop/en-gb/functions_all_alphabetical.htm)

[Tableau Functions (by Category)](https://help.tableau.com/v0.0/public/desktop/en-gb/functions_all_categories.htm)

[Writing Calculations in Tableau](https://help.tableau.com/v0.0/public/desktop/en-gb/functions_operators.htm)