---
schema_version: "1"
id: d1cf8d51901354ee126e9d894c1366620f9fc39b77359ef3b68fff4f80dbb19b
title: All Functions (Categorical)
collection: tableau
version: current
locale: en-us
portal_url: https://docs.salesforce.com/tableau/current/en-us/public/desktop/functions_all_categories.md
canonical_url: https://help.tableau.com/current/public/desktop/en-us/functions_all_categories.htm
source_site: help.tableau.com
content_type: documentation
content_hash: a1aa5c527dfead59261a682ca74ab6e7c60aacbb7319cbbaccf5388dcd34925c
description: Reference of all Tableau calculation functions organized by category.
---
[Skip to main content](#main-content)

# Tableau Functions (by Category)

The Tableau functions in this reference are organized by category. Click a category to browse its functions. Or press Ctrl+F (Command-F on a Mac) to open a search box that you can use to search the page for a specific function.

Number functions

### 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 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.</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 10's, -2 rounds to 100's, 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-us/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>

String functions

### ASCII

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ASCII(string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Number</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the ASCII code for the first character of a <code>&lt;string&gt;</code>. </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>ASCII('A') = 65</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>This is the inverse of the <code>CHAR</code> function. </td>
                                </tr>
                            </tbody>
                        </table>

### CHAR

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>CHAR(number)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the character encoded by the ASCII code <code>&lt;number&gt;</code>.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>CHAR(65) = 'A'</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>This is the inverse of the <code>ASCII</code> function. </td>
                                </tr>
                            </tbody>
                        </table>

### CONTAINS

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>CONTAINS(string, substring)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>	
Returns true if the given string contains the specified substring.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>CONTAINS("Calculation", "alcu") = true</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>See also the <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_logical.htm" target="_blank">logical function</a> <code>IN</code> as well as supported RegEx in the <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_additional.htm" target="_blank">additional functions documentation</a>. </p>
                                        <p>Depending on the data source, CONTAINS may be case sensitive. That is, for some data sources, <code>CONTAINS("Calculation", "ALCU") = false</code> but <code>CONTAINS("Calculation", "alcu") = true</code>. See also <a href="#UPPER" class="xref">UPPER</a>, <a href="#LOWER" class="xref">LOWER</a>, and <a href="#PROPER" class="xref">PROPER</a>. </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### ENDSWITH

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ENDSWITH(string, substring)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns true if the given string ends with the specified substring. Trailing white spaces are ignored.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>ENDSWITH("Tableau", "leau") = true</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also the supported RegEx in the <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_additional.htm" target="_blank">additional functions documentation</a>. </td>
                                </tr>
                            </tbody>
                        </table>

### FIND

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>FIND(string, substring, [start])</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Number</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Returns the index position of substring in string, or 0 if the substring isn't found. The first character in the string is position 1.</p>
                                        <p>If the optional numeric argument <code>start</code> is added, the function ignores any instances of substring that appear before the  starting position. </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>FIND("Calculation", "alcu") = 2</pre><pre>FIND("Calculation", "Computer") = 0</pre><pre xml:space="preserve">FIND("Calculation", "a", 3) = 7</pre><pre xml:space="preserve">FIND("Calculation", "a", 2) = 2</pre><pre xml:space="preserve">FIND("Calculation", "a", 8) = 0</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also the supported RegEx in the <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_additional.htm" target="_blank">additional functions documentation</a>. </td>
                                </tr>
                            </tbody>
                        </table>

### FINDNTH

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>FINDNTH(string, substring, occurrence)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Number</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the position of the nth occurrence of substring within the specified string, where n is defined by the occurrence argument.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>FINDNTH("Calculation", "a", 2) = 7</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p><code>FINDNTH</code> is not available for all data sources.</p>
                                        <p>See also the supported RegEx in the <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_additional.htm" target="_blank">additional functions documentation</a>. </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### LEFT

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>	LEFT(string, number)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the left-most <code>&lt;number&gt;</code> of characters in the string.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>LEFT("Matador", 4) = "Mata"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <a href="#MID" class="xref">MID</a> and <a href="#RIGHT" class="xref">RIGHT</a>. </td>
                                </tr>
                            </tbody>
                        </table>

### LEN

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>LEN(string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Number</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the length of the string.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>LEN("Matador") = 7</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>Not to be confused with the <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_spatial.htm" target="_blank">spatial function</a> <code>LENGTH</code>. </td>
                                </tr>
                            </tbody>
                        </table>

### LOWER

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>LOWER(string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the provided <code>&lt;string&gt;</code> in all lowercase characters.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>LOWER("ProductVersion") = "productversion"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <a href="#UPPER" class="xref">UPPER</a> and <a href="#PROPER" class="xref">PROPER</a>. </td>
                                </tr>
                            </tbody>
                        </table>

### LTRIM

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>	LTRIM(string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the provided <code>&lt;string&gt;</code> with any leading spaces removed.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>LTRIM(" Matador ") = "Matador "</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <a href="#RTRIM" class="xref">RTRIM</a>. </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>

### MID

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>(MID(string, start, [length])</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Returns a string starting at the specified <code>start</code> position. The first character in the string is position 1. </p>
                                        <p>If the optional numeric argument <code>length</code> is added, the returned string includes only that number of characters.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>MID("Calculation", 2) = "alculation"</pre><pre>MID("Calculation", 2, 5) ="alcul"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also the supported RegEx in the <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_additional.htm" target="_blank">additional functions documentation</a>. </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>

### PROPER

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>PROPER(string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Returns the provided <code>&lt;string&gt;</code> with the first letter of each word is capitalized and the remaining letters are in lowercase. </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>PROPER("PRODUCT name") = "Product Name"</pre><pre>PROPER("darcy-mae") = "Darcy-Mae"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Spaces and non-alphanumeric characters such as punctuation are treated as separators.</p>
                                        <p>See also <a href="#LOWER" class="xref">LOWER</a> and <a href="#UPPER" class="xref">UPPER</a>.</p>
                                    </td>
                                </tr> <tr><td>Database limitations</td><td>PROPER is only available for some flat files and in extracts. If you need to use PROPER in a data source that doesn't otherwise support it, consider using an extract. 					</td></tr></tbody>
                        </table>

### REPLACE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>REPLACE(string, substring, replacement</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Searches <code>&lt;string&gt;</code> for <code>&lt;substring&gt;</code> and replaces it with <code>&lt;replacement&gt;</code>. If <code>&lt;substring&gt;</code> is not found, the string is not changed.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">REPLACE("Version 3.8", "3.8", "4x") = "Version 4x"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <code>REGEXP_REPLACE</code> in the <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_additional.htm" target="_blank">additional functions documentation</a>. </td>
                                </tr>
                            </tbody>
                        </table>

### RIGHT

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>RIGHT(string, number)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the right-most <code>&lt;number&gt;</code> of characters in the string.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>RIGHT("Calculation", 4) = "tion"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <a href="#LEFT" class="xref">LEFT</a> and <a href="#MID" class="xref">MID</a>.</td>
                                </tr>
                            </tbody>
                        </table>

### RTRIM

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>RTRIM(string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the provided <code>&lt;string&gt;</code> with any trailing spaces removed.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>RTRIM(" Calculation ") = " Calculation"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <a href="#LTRIM" class="xref">LTRIM</a> and <a href="#TRIM" class="xref">TRIM</a>.</td>
                                </tr>
                            </tbody>
                        </table>

### SPACE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>SPACE(number)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String (specifically, just spaces)</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>	
Returns a string that is composed of the specified number of repeated spaces.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>SPACE(2) = "  "</pre>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### SPLIT

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>SPLIT(string, delimiter, token number)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns a substring from a string, using a delimiter character to divide the string into a sequence of tokens.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>SPLIT ("a-b-c-d", "-", 2) = "b"</pre><pre>SPLIT ("a|b|c|d", "|", -2) = "c"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>The string is interpreted as an alternating sequence of delimiters and tokens. So for the string <code>abc-defgh-i-jkl</code>, where the delimiter character is '<code>-</code>', the tokens are (1) <code>abc</code>, (2) <code>defgh</code>, (3) <code>i</code>, and (4) <code>jlk</code>.</p>
                                        <p><code>SPLIT</code> returns the token corresponding to the token number. When the token number is positive, tokens are counted starting from the left end of the string; when the token number is negative, tokens are counted starting from the right.</p>
                                        <p>See also supported REGEX in the <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_additional.htm" target="_blank">additional functions documentation</a>. </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Database limitations</td>
                                    <td>
                                        <p>The split and custom split commands are available for the following data sources types: Tableau data extracts, Microsoft Excel, Text File, PDF File, Salesforce, OData, Microsoft Azure Market Place, Google Analytics, Vertica, Oracle, MySQL, PostgreSQL, Teradata, Amazon Redshift, Aster Data, Google Big Query, Cloudera Hadoop Hive, Hortonworks Hive, and Microsoft SQL Server.</p>
                                        <p>Some data sources impose limits on splitting strings. See SPLIT&nbsp;function limitations later in this topic. </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### STARTSWITH

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>STARTSWITH(string, substring)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns true if <code>string</code> starts with <code>substring</code>. Leading white spaces are ignored.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">STARTSWITH("Matador, "Ma") = TRUE</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <a href="#CONTAINS" class="xref">CONTAINS</a>, as well as supported REGEX in the <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_additional.htm" target="_blank">additional functions documentation</a>. </td>
                                </tr>
                            </tbody>
                        </table>

### TRIM

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>TRIM(string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the provided <code>&lt;string&gt;</code> with leading and trailing spaces removed.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>TRIM(" Calculation ") = "Calculation"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <a href="#LTRIM" class="xref">LTRIM</a> and <a href="#RTRIM" class="xref">RTRIM</a>. </td>
                                </tr>
                            </tbody>
                        </table>

### UPPER

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>UPPER(string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the provided <code>&lt;string&gt;</code> in all uppercase characters.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>UPPER("Calculation") = "CALCULATION"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <a href="#PROPER" class="xref">PROPER</a> and <a href="#LOWER" class="xref">LOWER</a>.</td>
                                </tr>
                            </tbody>
                        </table>

Date functions

**Note**: Date functions do not take account of the configured fiscal year start. See [Fiscal Dates](https://help.tableau.com/current/public/desktop/en-us/dates_fiscal.htm).

### DATE

Type conversion function that changes string and number expressions into dates, as long as they are in a recognizable format.

<table class="table--plain">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>DATE(expression)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Date</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns a date given a number, string, or date <code>&lt;expression&gt;</code>.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>DATE([Employee Start Date])</pre><pre>DATE("September 22, 2018") </pre><pre xml:space="preserve">DATE("9/22/2018")</pre><pre>DATE(#2018-09-22 14:52#)</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Unlike <code><a href="#DATEPARS" class="xref">DATEPARSE</a></code>, there is no need to provide a pattern as <code>DATE</code> automatically recognizes many standard date formats. If <code>DATE</code> does not recognize the input, however, try using <code>DATEPARSE</code> and specifying the format. </p>
                                        <p><code><a href="#MAKEDATE" class="xref">MAKEDATE</a></code> is another similar function, but <code>MAKEDATE</code> requires the input of numeric values for year, month, and day.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### DATEADD

Adds a specified number of date parts (months, days, etc) to the starting date.

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>DATEADD(date_part, interval, date)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Date</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the <code>&lt;date&gt;</code> with the specified number <code>&lt;interval&gt;</code> added to the specified <code>&lt;<a href="#arg" class="xref">date_part</a>&gt;</code> of that date. For example, adding three months or 12 days to a starting date.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td>
                                        <p>Push out all due dates by one week</p><pre>DATEADD('week', 1, [due date])</pre>
                                        <p>Add 280 days to the date February 20, 2021</p><pre xml:space="preserve">DATEADD('day', 280, #2/20/21#) = #November 27, 2021#</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>Supports ISO 8601 dates.</td>
                                </tr>
                            </tbody>
                        </table>

### DATEDIFF

Returns the number of date parts (weeks, years, etc) between two dates.

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>DATEDIFF(date_part, date1, date2, [start_of_week])</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the difference between <code>&lt;date1&gt;</code> and <code>&lt;date2&gt;</code> expressed in units of <code>&lt;<a href="#arg" class="xref">date_part</a>&gt;</code>. For example, subtracting the dates someone entered and left a band to see how long they were in the band.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td>
                                        <p>Number of days between March 25, 1986 and February 20, 2021
</p><pre>DATEDIFF('day', #3/25/1986#, #2/20/2021#) = 12,751</pre>
                                        <p>How many months someone was in a band
</p><pre>DATEDIFF('month', [date joined band], [date left band])</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>Supports ISO 8601 dates.</td>
                                </tr>
                            </tbody>
                        </table>

### DATENAME

Returns the name of the specified date part as a discrete string.

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>DATENAME(date_part, date, [start_of_week])</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns <code>&lt;<a href="#arg" class="xref">date_part</a>&gt;</code> of <code>&lt;date&gt;</code> as a string.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>DATENAME('year', #3/25/1986#) = "1986"</pre><pre>DATENAME('month', #1986-03-25#) = "March"</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Supports ISO 8601 dates.</p>
                                        <p>A very similar calculation is <a href="#DATEPART" class="xref">DATEPART</a>, which returns the value of the specified date part as a continuous integer. <code>DATEPART</code> can be faster because it is a numerical operation. </p>
                                        <p>By changing the attributes of the calculation’s result (dimension or measure, continuous or discrete) and the date formatting, the results of <code>DATEPART</code> and <code>DATENAME</code> can be formatted to be identical. </p>
                                        <p>An inverse function is <a href="#DATEPARS" class="xref">DATEPARSE</a>, which takes a string value and formats it as a date.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### DATEPARSE

Returns specifically formatted strings as dates.

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>DATEPARSE(date_format, date_string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Date</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>The <code>&lt;date_format&gt;</code> argument describes how the <code>&lt;date_string&gt;</code> field is arranged. Because of the variety of ways the string field can be ordered, the <code>&lt;date_format&gt;</code> must match exactly. For a full explanation and formatting details, see <a href="https://help.tableau.com/current/pro/desktop/en-us/data_dateparse.htm" target="_blank">Convert a Field to a Date Field</a>.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">DATEPARSE('yyyy-MM-dd', "1986-03-25") = #March 25, 1986#</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p><code><a href="#top" class="xref">DATE</a></code> is a similar function that automatically recognizes many standard date formats.  <code>DATEPARSE</code> may be a better option if <code>DATE</code> does not recognize the input pattern. </p>
                                        <p><code><a href="#MAKEDATE" class="xref">MAKEDATE</a></code> is another similar function, but <code>MAKEDATE</code> requires the input of numeric values for year, month, and day. </p>
                                        <p>Inverse functions, which take dates apart and return the value of their parts, are <code><a href="#DATEPART" class="xref">DATEPART</a></code> (integer output) and <code><a href="#DATENAME" class="xref">DATENAME</a></code> (string output). </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Database limitations</td>
                                    <td>
                                        <p><code>DATEPARSE</code> is available through the following connectors: non-legacy Excel and text file connections, Amazon EMR Hadoop Hive, Cloudera Hadoop, Google Sheets, Hortonworks Hadoop Hive, MapR Hadoop Hive, MySQL, Oracle, PostgreSQL, and Tableau extracts. Some formats may not be available for all connections.</p>
                                        <p><code>DATEPARSE</code> is not supported on Hive variants. Only Denodo, Drill, and Snowflake are supported.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### DATEPART

Returns the name of the specified date part as an integer.

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>DATEPART(date_part, date, [start_of_week])</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns <code>&lt;<a href="#arg" class="xref">date_part</a>&gt;</code> of <code>&lt;date&gt;</code> as an integer.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>DATEPART('year', #1986-03-25#) = 1986</pre><pre>DATEPART('month', #1986-03-25#) = 3</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Supports ISO 8601 dates.</p>
                                        <p>A very similar calculation is <code><a href="#DATENAME" class="xref">DATENAME</a></code>, which returns the name of the specified date part as a discrete string. <code>DATEPART</code> can be faster because it is a numerical operation. By changing the attributes of the field (dimension or measure, continuous or discrete) and the date formatting, the results of <code>DATEPART</code> and <code>DATENAME</code> can be formatted to be identical. </p>
                                        <p>An inverse function is <code><a href="#DATEPARS" class="xref">DATEPARSE</a></code>, which takes a string value and formats it as a date.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### DATETRUNC

This function can be thought of as date rounding. It takes a specific date and returns a version of that date at the desired specificity. Because every date must have a value for day, month, quarter, and year, `DATETRUNC` sets the values as the lowest value for each date part up to the date part specified. Refer to the example for more information.

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>DATETRUNC(date_part, date, [start_of_week])</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Date</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Truncates the <code>&lt;date&gt;</code> to the accuracy specified by the <code>&lt;<a href="#arg" class="xref">date_part</a>&gt;</code>. This function returns a new date. For example, when you truncate a date that is in the middle of the month at the month level, this function returns the first day of the month. </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">DATETRUNC('day', #9/22/2018#) = #9/22/2018#</pre><pre xml:space="preserve">DATETRUNC('iso-week', #9/22/2018#) = #9/17/2018#</pre>
                                        <p>(the monday of the week containing 9/22/2018)</p><pre xml:space="preserve">DATETRUNC(quarter, #9/22/2018#) = #7/1/2018# </pre>
                                        <p>(the first day of the quarter containing 9/22/2018)</p>
                                        <p class="note">Note: For week and iso-week, the <code>start_of_week</code> comes into play. ISO-weeks always start on Monday. For the locale of this example, an unspecified <code>start_of_week</code> means the week starts on Sunday.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Supports ISO 8601 dates.</p>
                                        <p>You shouldn't use <code>DATETRUNC</code> to, for example, stop showing the time for a datetime field in a viz.  If you want to truncate the way a date displays rather than round its accuracy, <a href="https://help.tableau.com/current/pro/desktop/en-us/dates_custom_date_formats.htm" target="_blank">adjust the formatting</a>. </p>
                                        <p>For example, <code>DATETRUNC('day', #5/17/2022 3:12:48 PM#)</code>,  if formatted in the viz to display seconds, would display as <code>5/17/2022 12:00:00 AM</code>. The value is truncated to day, but the display goes to seconds. </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### DAY

Returns the day of the month (1-31) as an integer.

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>DAY(date)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the day of the given <code>&lt;date&gt;</code> as an integer.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>Day(#September 22, 2018#) = 22</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <code><a href="#WEEK" class="xref">WEEK</a></code>, <code><a href="#MONTH" class="xref">MONTH</a></code>, <code><a href="#QUARTER" class="xref">QUARTER</a></code>, <code><a href="#YEAR" class="xref">YEAR</a></code>, and the ISO equivalents.</td>
                                </tr>
                            </tbody>
                        </table>

### ISDATE

Checks if the string is a valid date format.

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ISDATE(string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns true if a given <code>&lt;string&gt;</code> is a valid date.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>ISDATE(09/22/2018) = true</pre><pre>ISDATE(22SEP18) = false</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>The required argument must be a string. ISDATE cannot be used for a field with a date data type—the calculation will return an error. </td>
                                </tr>
                            </tbody>
                        </table>

### ISOQUARTER

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ISOQUARTER(date)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the ISO8601 week-based quarter of a given <code>&lt;date&gt;</code> as an integer.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>ISOQUARTER(#1986-03-25#) = 1</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <code><a href="#ISOWEEK" class="xref">ISOWEEK</a></code>, <code><a href="#ISOWEEKDAY" class="xref">ISOWEEKDAY</a></code>,  <code><a href="#ISOYEAR" class="xref">ISOYEAR</a></code>, and the non-ISO equivalents.</td>
                                </tr>
                            </tbody>
                        </table>

### ISOWEEK

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ISOWEEK(date)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the ISO8601 week-based week of a given <code>&lt;date&gt;</code> as an integer.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>ISOWEEK(#1986-03-25#) = 13</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <code><a href="#ISOWEEKDAY" class="xref">ISOWEEKDAY</a></code>, <code><a href="#ISOQUARTER" class="xref">ISOQUARTER</a></code>, <code><a href="#ISOYEAR" class="xref">ISOYEAR</a></code>, and the non-ISO equivalents.</td>
                                </tr>
                            </tbody>
                        </table>

### ISOWEEKDAY

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ISOWEEKDAY(date)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the ISO8601 week-based weekday of a given <code>&lt;date&gt;</code> as an integer.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>ISOWEEKDAY(#1986-03-25#) = 2</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <code><a href="#ISOWEEK" class="xref">ISOWEEK</a></code>, <code><a href="#ISOQUARTER" class="xref">ISOQUARTER</a></code>, <code><a href="#ISOYEAR" class="xref">ISOYEAR</a></code>, and the non-ISO equivalents.</td>
                                </tr>
                            </tbody>
                        </table>

### ISOYEAR

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ISOYEAR(date)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the ISO8601 week-based year of a given <code>&lt;date&gt;</code> as an integer.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>ISOYEAR(#1986-03-25#) = 1,986</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <code><a href="#ISOWEEK" class="xref">ISOWEEK</a></code>, <code><a href="#ISOWEEKDAY" class="xref">ISOWEEKDAY</a></code>, <code><a href="#ISOQUARTER" class="xref">ISOQUARTER</a></code>, and the non-ISO equivalents.</td>
                                </tr>
                            </tbody>
                        </table>

### MAKEDATE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>MAKEDATE(year, month, day)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Date</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns a date value constructed from the specified <code>&lt;year&gt;</code>, <code>&lt;month&gt;</code>, and <code>&lt;day&gt;</code>.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">MAKEDATE(1986,3,25) = #1986-03-25#</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p class="note"><b>Note</b>: Incorrectly entered values will be adjusted into a date, such as <code>MAKEDATE(2020,4,31) = May 1, 2020</code> rather than returning an error that there is no 31st day of April.</p>
                                        <p>Available for Tableau Data Extracts. Check for availability in other data sources.</p>
                                        <p><code>MAKEDATE</code> requires numerical inputs for the parts of a date. If your data is a string that should be a date, try the <code><a href="#top" class="xref">DATE</a></code> function. <code>DATE</code> automatically recognizes many standard date formats. If <code>DATE</code> does not recognize the input try using <code><a href="#DATEPARS" class="xref">DATEPARSE</a></code>.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### MAKEDATETIME

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>MAKEDATETIME(date, time)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Datetime</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns a datetime that combines a <code>&lt;date&gt;</code> and a <code>&lt;time&gt;</code>. The date can be a date, datetime, or a string type. The time must be a datetime.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>MAKEDATETIME("1899-12-30", #07:59:00#) = #12/30/1899 7:59:00 AM#</pre><pre>MAKEDATETIME([Date], [Time]) = #1/1/2001 6:00:00 AM#</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>This function is available only for MySQL-compatible connections (which for Tableau are MySQL and Amazon Aurora).</p>
                                        <p><code><a href="#MAKETIME" class="xref">MAKETIME</a></code> is a similar function available for Tableau Data Extracts and some other data sources.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### MAKETIME

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>MAKETIME(hour, minute, second)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Datetime</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns a date value constructed from the specified <code>&lt;hour&gt;</code>, <code>&lt;minute&gt;</code>, and <code>&lt;second&gt;</code>.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>MAKETIME(14, 52, 40) = #1/1/1899 14:52:40#</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Because Tableau does not support a time data type, only datetime, the output is a datetime. The date portion of the field will be 1/1/1899.</p>
                                        <p>Similar function to <code><a href="#MAKEDATETIME" class="xref">MAKEDATETIME</a></code>, which is only available for MYSQL-compatible connections.</p>
                                    </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</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>

### MONTH

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>MONTH(date)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the month of the given <code>&lt;date&gt;</code> as an integer.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>MONTH(#1986-03-25#) = 3</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <code><a href="#DAY" class="xref">DAY</a></code>, <code><a href="#WEEK" class="xref">WEEK</a></code>, <code><a href="#QUARTER" class="xref">QUARTER</a></code>, <code><a href="#YEAR" class="xref">YEAR</a></code>, and the ISO equivalents</td>
                                </tr>
                            </tbody>
                        </table>

### NOW

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>NOW()</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Datetime</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the current local system date and time. </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>NOW() = 1986-03-25 1:08:21 PM</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p><code>NOW</code> does not take an argument. </p>
                                        <p>See also <code><a href="#TODAY" class="xref">TODAY</a></code>, a similar calculation that returns a date instead of a datetime.</p>
                                        <p>If the data source is a live connection, the system date and time could be in another timezone. For more information on how to address this, see <a href="https://kb.tableau.com/articles/issue/now-function-returns-utc-time">the Knowledge Base</a>. </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### QUARTER

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>QUARTER(date)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the quarter of the given <code>&lt;date&gt;</code> as an integer.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>QUARTER(#1986-03-25#) = 1</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <code><a href="#DAY" class="xref">DAY</a></code>, <code><a href="#WEEK" class="xref">WEEK</a></code>, <code><a href="#MONTH" class="xref">MONTH</a></code>, <code><a href="#YEAR" class="xref">YEAR</a></code>, and the ISO equivalents</td>
                                </tr>
                            </tbody>
                        </table>

### TODAY

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>TODAY()</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Date</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the current local system date.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>TODAY() = 1986-03-25</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p><code>TODAY</code> does not take an argument. </p>
                                        <p>See also <a href="#NOW" class="xref">NOW</a>, a similar calculation that returns a datetime instead of a date. </p>
                                        <p>If the data source is a live connection, the system date could be in another timezone. For more information on how to address this, see <a href="https://kb.tableau.com/articles/issue/now-function-returns-utc-time">the Knowledge Base</a>. </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### WEEK

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>WEEK(date)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the week of the given <code>&lt;date&gt;</code> as an integer.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>WEEK(#1986-03-25#) = 13</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <code><a href="#DAY" class="xref">DAY</a></code>, <code><a href="#MONTH" class="xref">MONTH</a></code>, <code><a href="#QUARTER" class="xref">QUARTER</a></code>, <code><a href="#YEAR" class="xref">YEAR</a></code>, and the ISO equivalents</td>
                                </tr>
                            </tbody>
                        </table>

### YEAR

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>YEAR(date)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Integer</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the year of the given <code>&lt;date&gt;</code> as an integer.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">YEAR(#1986-03-25#) = 1,986</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>See also <code><a href="#DAY" class="xref">DAY</a></code>, <code><a href="#WEEK" class="xref">WEEK</a></code>, <code><a href="#MONTH" class="xref">MONTH</a></code>, <code><a href="#QUARTER" class="xref">QUARTER</a></code>, and the ISO equivalents</td>
                                </tr>
                            </tbody>
                        </table>

## date\_part

Many date functions in Tableau take the argument `date_part`, which is a string constant that tells the function what part of a date to consider, such as day, week, quarter, etc. The valid `date_part` values that you can use are:

 
| date\_part | Values |
| --- | --- |
| `'year'` | Four-digit year |
| `'quarter'` | 1-4 |
| `'month'` | 1-12 or "January", "February", and so on |
| `'dayofyear'` | Day of the year; Jan 1 is 1, Feb 1 is 32, and so on |
| `'day'` | 1-31 |
| `'weekday'` | 1-7 or "Sunday", "Monday", and so on |
| `'week'` | 1-52 |
| `'hour'` | 0-23 |
| `'minute'` | 0-59 |
| `'second'` | 0-60 |
| `'iso-year'` | Four-digit ISO 8601 year |
| `'iso-quarter'` | 1-4 |
| `'iso-week'` | 1-52, start of week is always Monday |
| `'iso-weekday'` | 1-7, start of week is always Monday |

Logical functions

### AND

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>&lt;expr1&gt; AND &lt;expr2&gt;</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Performs a logical conjunction on two expressions. (If both sides are true, the logical test returns true.)</td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean (true or false)</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>IF [Season] = "Spring" AND "[Season] = "Fall" <br>THEN "It's the apocalypse and footwear doesn't matter" <br>END</pre>
                                        <p><i>"If both (Season = Spring) and (Season = Fall) are true simultaneously, then return It's the apocalypse and footwear doesn't matter".</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Often used with <a href="#IF" class="xref">IF</a> and <a href="#IIF" class="xref">IIF</a>. See also <a href="#NOT" class="xref">NOT</a> and <a href="#OR" class="xref">OR</a>. </p>
                                        <p>If both expressions are <code>TRUE</code> (that is, not <code>FALSE</code> or <code>NULL</code>), then the result is <code>TRUE</code>. If either expression is <code>NULL</code>, then the result is <code>NULL</code>. In all other cases, the result is <code>FALSE</code>.
</p>
                                        <p>If you create a calculation in which the result of an <code>AND</code> comparison is displayed on a worksheet, Tableau displays <code>TRUE</code> and <code>FALSE</code>. If you would like to change this, use the Format area in the format dialog.
</p>
                                        <p class="note"><b>Note</b>:&nbsp;The <code>AND</code> operator employs <i>short circuit evaluation</i>. This means that if the first expression is evaluated to be <code>FALSE</code>, then the second expression is not evaluated at all. This can be helpful if the second expression results in an error when the first expression is <code>FALSE</code>, because the second expression in this case is never evaluated.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### CASE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code><b>CASE</b> &lt;expression&gt; 
                        <br>WHEN &lt;value1&gt; THEN &lt;then1&gt; 
                        <br>WHEN &lt;value2&gt; THEN &lt;then2&gt; 
                        <br>...
                        <br>[ELSE &lt;default&gt;]<br>END</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Depends on data type of the <code>&lt;then&gt;</code>&nbsp;values. </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Evaluates the <code>expression</code> and compares it to the specified options (<code>&lt;value1&gt;</code>, <code>&lt;value2&gt;</code>, etc.). When a <code>value</code> that matches expression is encountered, CASE returns the corresponding <code>return</code>. If no match is found, the (optional) default is returned. If there is no default and no values match, then Null is returned.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve"><code><b>CASE</b> [Season] <br>WHEN 'Summer' THEN 'Sandals' <br>WHEN 'Winter' THEN 'Boots' <br>ELSE 'Sneakers' <br>END</code></pre>
                                        <p><i>"Look at the Season field. If the value is Summer, then return Sandals. If the value is Winter, then return Boots. If none of the options in the calculation match what is in the Season field, return a Sneakers."</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>See also <a href="#IF" class="xref">IF</a> and <a href="#IIF" class="xref">IIF</a>. </p>
                                        <p>Used with <a href="#WHEN" class="xref">WHEN</a>, <a href="#THEN" class="xref">THEN</a>, <a href="#ELSE" class="xref">ELSE</a>, and <a href="#END" class="xref">END</a>. </p>
                                        <blockquote><p>[!TIP]</p><p>Many times you can use a group to get the same results as a complicated CASE function, or use CASE to replace native grouping functionality, such as in the previous example. You may want to test which is more performant for your scenario.</p></blockquote>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### ELSE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>CASE &lt;expression&gt; 
							<br>WHEN &lt;value1&gt; THEN &lt;then1&gt; 
							<br>WHEN &lt;value2&gt; THEN &lt;then2&gt; 
							<br>...
						<br>[<b>ELSE</b> &lt;default&gt;]<br>END</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>An optional piece of an <code>IF</code>&nbsp;or <code>CASE</code> expression used to specify a default value to return if none of the tested expressions are true. </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">IF [Season] = "Summer"&nbsp;THEN&nbsp;'Sandals' <br>ELSEIF&nbsp;[Season] = "Winter"&nbsp;THEN&nbsp;'Boots' <br><b>ELSE</b>&nbsp;'Sneakers'&nbsp;<br>END</pre><pre>CASE [Season] <br>WHEN 'Summer' THEN 'Sandals' <br>WHEN 'Winter' THEN 'Boots' <br><b>ELSE</b> 'Sneakers' <br>END</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Used with <a href="#CASE" class="xref">CASE</a>, <a href="#WHEN" class="xref">WHEN</a>, <a href="#IF" class="xref">IF</a>, <a href="#ELSEIF" class="xref">ELSEIF</a>, <a href="#THEN" class="xref">THEN</a>,  and <a href="#END" class="xref">END</a></p>
                                        <p><code>ELSE</code> is optional with <code>CASE</code> and <code>IF</code>. In a calculation where <code>ELSE</code> is not specified, if none of the <code>&lt;test&gt;</code>are true, the overall calculation will return null. </p>
                                        <p><code>ELSE</code> does not require a condition (such as <code>[Season] = "Winter"</code>) and can be thought of as a form of null handling. </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### ELSEIF

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>[<b>ELSEIF</b> &lt;test2&gt; THEN &lt;then2&gt;]</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>An optional piece of an <code>IF</code>&nbsp;expression used to specify additional conditions beyond the initial IF.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">IF [Season] = "Summer" THEN 'Sandals' <br><b>ELSEIF</b> [Season] = "Winter" THEN 'Boots' <br><b>ELSEIF</b> [Season] = "Spring" THEN 'Sneakers' <br><b>ELSEIF</b> [Season] = "Autumn" THEN 'Sneakers'<br>ELSE 'Bare feet' <br>END</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Used with <a href="#IF" class="xref">IF</a>,  <a href="#THEN" class="xref">THEN</a>, <a href="#ELSE" class="xref">ELSE</a>, and <a href="#END" class="xref">END</a></p>
                                        <p><code>ELSEIF</code> can be thought of as additional <code>IF</code> clauses. <code>ELSEIF</code> is optional and can be repeated multiple times. </p>
                                        <p>Unlike <code>ELSE</code>, <code>ELSEIF</code> requires a condition (such as <code>[Season] = "Winter"</code>).</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### END

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Definition</td>
                                    <td>Used to close an <code>IF</code>&nbsp;or <code>CASE</code> expression. </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">IF [Season] = "Summer"&nbsp;THEN&nbsp;'Sandals' <br>ELSEIF&nbsp;[Season] = "Winter"&nbsp;THEN&nbsp;'Boots' <br>ELSE&nbsp;'Sneakers'&nbsp;<br><b>END</b></pre>
                                        <p><i>"If Season = Summer, then return Sandals. If not, look at the next expression. If Season = Winter, then return Boots. If neither of the expressions are true, return Sneakers."</i>
                                        </p><pre>CASE [Season] <br>WHEN 'Summer' THEN 'Sandals' <br>WHEN 'Winter' THEN 'Boots' <br>ELSE 'Sneakers' <br><b>END</b></pre>
                                        <p><i><i>"Look at the Season field. If the value is Summer, then return Sandals. If the value is Winter, then return Boots. If none of the options in the calculation match what is in the Season field, return a Sneakers."</i></i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Used with <a href="#CASE" class="xref">CASE</a>, <a href="#WHEN" class="xref">WHEN</a>, <a href="#IF" class="xref">IF</a>, <a href="#ELSEIF" class="xref">ELSEIF</a>, <a href="#THEN" class="xref">THEN</a>, and <a href="#ELSE" class="xref">ELSE</a>.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### IF

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code><b>IF</b> &lt;test1&gt; THEN &lt;then1&gt; <br>[ELSEIF &lt;test2&gt; THEN &lt;then2&gt;...]<br>[ELSE &lt;default&gt;] <br>END</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Depends on data type of the <code>&lt;then&gt;</code>&nbsp;values. </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Tests a series of expressions  and returns the <code>&lt;then&gt;</code> value for the first true <code>&lt;test&gt;</code>.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">IF [Season] = "Summer"&nbsp;THEN&nbsp;'Sandals' <br>ELSEIF&nbsp;[Season] = "Winter"&nbsp;THEN&nbsp;'Boots' <br>ELSE&nbsp;'Sneakers'&nbsp;<br><b>END</b></pre>
                                        <p><i>"If Season = Summer, then return Sandals. If not, look at the next expression. If Season = Winter, then return Boots. If neither of the expressions are true, return Sneakers."</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>See also <a href="#IF" class="xref">IF</a> and <a href="#IIF" class="xref">IIF</a>. </p>
                                        <p>Used with <a href="#ELSEIF" class="xref">ELSEIF</a>, <a href="#THEN" class="xref">THEN</a>, <a href="#ELSE" class="xref">ELSE</a>, and <a href="#END" class="xref">END</a></p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### IFNULL

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>IFNULL(expr1, expr2)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Depends on the data type of the <code>&lt;expr&gt;</code> values. </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Returns <code>&lt;expr1&gt;</code> if it's non-null, otherwise returns <code>&lt;expr2&gt;</code>.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">IFNULL([Assigned Room], "TBD")</pre>
                                        <p><i>"If the Assigned Room field isn't null, return its value. If the Assigned room field is null, return TBD instead."</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Compare with <a href="#ISNULL" class="xref">ISNULL</a>. <code>IFNULL</code> always returns a value. <code>ISNULL</code>&nbsp;returns a boolean (true or false). </p>
                                        <p>See also <a href="#ZN" class="xref">ZN</a>. </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### IIF

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code><b>IIF</b>(&lt;test&gt;, &lt;then&gt;, &lt;else&gt;, [&lt;unknown&gt;])</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Depends on the data type of the values in the expression. </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Checks whether a condition is met (<code>&lt;test&gt;</code>), and returns <code>&lt;then&gt;</code>if the test is true, <code>&lt;else&gt;</code>&nbsp;if the test is false, and an optional  value for <code>&lt;unknown&gt;</code> if the test is null. If the optional unknown isn't specified, <code>IIF</code> returns null. </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">IIF([Season] = 'Summer', 'Sandals', 'Other footwear')</pre>
                                        <p><i>"If Season = Summer, then return Sandals. If not, return Other footwear"</i>
                                        </p><pre xml:space="preserve">IIF([Season] = 'Summer', 'Sandals', <br>   IIF('Season' = 'Winter', 'Boots',  'Other footwear')<br>)</pre>
                                        <p><i>"If Season = Summer, then return Sandals. If not, look at the next expression. If Season = Winter, then return Boots. If neither are true, return Sneakers."</i>
                                        </p><pre xml:space="preserve">IIF('Season' = 'Summer', 'Sandals', <br>   IIF('Season' = 'Winter', 'Boots',  <br>      IIF('Season' = 'Spring', 'Sneakers', 'Other footwear')<br>   )<br>)</pre>
                                        <p><i>"If Season = Summer, then return Sandals. If not, look at the next expression. If Season = Winter, then return Boots. If none of the expressions are true, return Sneakers."</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>See also <a href="#IF" class="xref">IF</a> and<a href="#CASE" class="xref">CASE</a>. </p>
                                        <p><code>IIF</code> doesn't have an equivalent to <code>ELSEIF</code> (like <code>IF</code>)&nbsp;or repeated <code>WHEN</code> clauses (like <code>CASE</code>). Instead, multiple tests can be evaluated sequentially by nesting <code>IIF</code> statements as the <code>&lt;unknown&gt;</code>&nbsp;element. The first (outermost) true  is returned. </p>
                                        <p>That is to say, in the calculation below,  the result will be Red, not Orange, because the expression stops being evaluated as soon as A=A is evaluated as true: </p>
                                        <p> <code>IIF('A' = 'A', 'Red', IIF('B' = 'B', 'Orange',  IIF('C' = 'D', 'Yellow', 'Green')))</code></p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### IN

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>&lt;expr1&gt; IN &lt;expr2&gt;</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean (true or false)</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>	
Returns <code>TRUE</code> if any value in <code>&lt;expr1&gt;</code> matches any value in <code>&lt;expr2&gt;</code>.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">SUM([Cost]) IN&nbsp;(1000, 15, 200)</pre>
                                        <p><i>"Is the value of the Cost field 1000, 15, or 200?"</i>
                                        </p><pre xml:space="preserve">[Field] IN&nbsp;[Set]</pre>
                                        <p><i>"Is the value of the field present in the set?"</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>The values in <code>&lt;expr2&gt;</code> can be a set, list of literal values, or combined field.</p>
                                        <p>See also  <a href="#WHEN" class="xref">WHEN</a>. </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### ISDATE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ISDATE(string)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean (true or false)</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns true if a <code>&lt;string&gt;</code> is a valid date. The input expression must be a string (text)&nbsp;field. </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">ISDATE("2018-09-22")</pre>
                                        <p><i>"Is the string 2018-09-22 a properly formatted date?"</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>What is considered a valid date depends on the <a href="https://help.tableau.com/current/server/en-us/lang_intro.htm" target="_blank">locale</a> of the system evaluating the calculation. For example:</p>
                                        <p>In the USA: </p>
                                        <ul>
                                            <li><code>ISDATE("2018-09-22") = TRUE</code>
                                            </li>
                                            <li><code>ISDATE("2018-22-09") = FALSE</code>
                                            </li>
                                        </ul>
                                        <p>In the UK: </p><ul><li><code>ISDATE("2018-09-22") = FALSE</code> </li><li><code>ISDATE("2018-22-09") = TRUE</code></li></ul><p></p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### ISNULL

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ISNULL(expression)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean (true or false)</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Returns true if the <code>&lt;expression&gt;</code> is NULL (does not contain valid data).</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">ISNULL([Assigned Room])</pre>
                                        <p><i>"Is the Assigned Room field null?"</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Compare with <a href="#IFNULL" class="xref">IFNULL</a>. <code>IFNULL</code> always returns a value. <code>ISNULL</code> returns a boolean.</p>
                                        <p>See also <a href="#ZN" class="xref">ZN</a>. </p>
                                    </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>

### NOT

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>NOT&nbsp;&lt;expression&gt;</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean (true or false)</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Performs logical negation on an expression.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">IF <b>NOT</b> [Season] = "Summer" <br>THEN 'Don't wear sandals' <br>ELSE&nbsp;'Wear sandals'&nbsp;<br><b>END</b></pre>
                                        <p><i>"If Season doesn't equal Summer, then return Don't wear sandals. If not,  return Wear sandals."</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Often used with <a href="#IF" class="xref">IF</a> and <a href="#IIF" class="xref">IIF</a>. See also <a href="#top" class="xref">DATE</a> and <a href="#OR" class="xref">OR</a>.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### OR

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>&lt;expr1&gt; OR &lt;expr2&gt;</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean (true or false)</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Performs a logical disjunction on two expressions.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">IF [Season] = "Spring"&nbsp;<b>OR</b>&nbsp;[Season] = "Fall" <br>THEN&nbsp;"Sneakers" <br>END</pre>
                                        <p><i>"If either (Season = Spring)&nbsp;or (Season = Fall)&nbsp;is true, then return Sneakers."</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Often used with <a href="#IF" class="xref">IF</a> and <a href="#IIF" class="xref">IIF</a>. See also <a href="#top" class="xref">DATE</a> and <a href="#NOT" class="xref">NOT</a>.</p>
                                        <p>If either expression
							is <code>TRUE</code>, then the result is <code>TRUE</code>.
							If both expressions are <code>FALSE</code>, then the result
							is <code>FALSE</code>. If both expressions are <code>NULL</code>,
						then the result is <code>NULL</code>. </p>
                                        <p>If you create
							a calculation which displays the result of an <code>OR</code> comparison
							on a worksheet, Tableau displays TRUE and FALSE. If
							you would like to change this, use the Format area in the format
						dialog. </p>
                                        <p class="note"><b>Note</b>:&nbsp;The <code>OR</code> operator employs <em>short circuit
							evaluation.</em> This means that if the first expression is evaluated
							to be <code>TRUE</code>, then the second expression is not evaluated
							at all. This can be helpful if the second expression results in
							an error when the first expression is <code>TRUE</code>, because
					the second expression in this case is never evaluated.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### THEN

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>IF &lt;test1&gt; <b>THEN</b> &lt;then1&gt; 
							<br>[ELSEIF &lt;test2&gt; <b>THEN</b> &lt;then2&gt;...]
							<br>[ELSE &lt;default&gt;] 
						<br>END</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>A required part of an <code>IF</code>, <code>ELSEIF</code>, or <code>CASE</code> expression, used to define what result to return if a specific value or test is true. </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">IF [Season] = "Summer"&nbsp;<b>THEN</b>&nbsp;'Sandals' <br>ELSEIF&nbsp;[Season] = "Winter"&nbsp;<b>THEN</b>&nbsp;'Boots' <br>ELSE&nbsp;'Sneakers'&nbsp;<br>END</pre>
                                        <p><i>"If Season = Summer, then return Sandals. If not, look at the next expression. If Season = Winter, then return Boots. If neither of the expressions are true, return Sneakers."</i>
                                        </p><pre>CASE [Season] <br>WHEN 'Summer' <b>THEN</b> 'Sandals' <br>WHEN 'Winter' <b>THEN</b> 'Boots' <br>ELSE 'Sneakers' <br>END</pre>
                                        <p><i><i>"Look at the Season field. If the value is Summer, then return Sandals. If the value is Winter, then return Boots. If none of the options in the calculation match what is in the Season field, return a Sneakers."</i></i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Used with <a href="#CASE" class="xref">CASE</a>, <a href="#WHEN" class="xref">WHEN</a>, <a href="#IF" class="xref">IF</a>, <a href="#ELSEIF" class="xref">ELSEIF</a>, <a href="#THEN" class="xref">THEN</a>, <a href="#ELSE" class="xref">ELSE</a>, and <a href="#END" class="xref">END</a></p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### WHEN

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>CASE &lt;expression&gt; 
							<br><b>WHEN</b> &lt;value1&gt; THEN &lt;then1&gt; 
							<br><b>WHEN</b> &lt;value2&gt; THEN &lt;then2&gt; 
							<br>...
						<br>[ELSE &lt;default&gt;]<br>END</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>A required part of a <code>CASE</code> expression. Finds the first <code>&lt;value&gt;</code> that matches <code>&lt;expression&gt;</code> and returns the corresponding <code>&lt;then&gt;</code>.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>CASE [Season] <br><b>WHEN</b> 'Summer' THEN 'Sandals' <br><b>WHEN</b> 'Winter' THEN 'Boots' <br>ELSE 'Sneakers' <br>END</pre>
                                        <p><i>"Look at the Season field. If the value is Summer, then return Sandals. If the value is Winter, then return Boots. If none of the options in the calculation match what is in the Season field, return a Sneakers."</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Used with <a href="#CASE" class="xref">CASE</a>, <a href="#THEN" class="xref">THEN</a>, <a href="#ELSE" class="xref">ELSE</a>, and <a href="#END" class="xref">END</a>. </p>
                                        <p><code>CASE</code> also supports <code>WHEN IN</code> construction, such as:</p><pre xml:space="preserve">CASE &lt;expression&gt; <br><b>WHEN IN</b> &lt;set1&gt; THEN &lt;then1&gt; <br><b>WHEN IN</b> &lt;combinedfield&gt; THEN &lt;then2&gt; <br>... <br>ELSE &lt;default&gt; <br>END</pre>
                                        <p>The values that <code>WHEN IN</code> compare to must be a set, list of literal values, or combined field. See also <a href="#IN" class="xref">IN</a>.</p>
                                    </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>Depends on the data type of the <code>&lt;expression&gt;</code>, or 0.</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns &lt;expression&gt; if it isn't null, otherwise returns zero.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">ZN([Test Grade])</pre>
                                        <p><i>"If the test grade isn't null, return its value. If the test grade is null, return 0."</i>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p><code>ZN</code> is a specialized case of <a href="#IFNULL" class="xref">IFNULL</a> where alternative if the expression is null is always 0 rather than being specified in the calculation. </p>
                                        <p><code>ZN</code> is especially useful when performing additional calculations and a null would render the entire calculation null. However, use caution interpreting these results as null is not always synonymous with 0 and could represent missing data. </p>
                                        <p>See also <a href="#ISNULL" class="xref">ISNULL</a>. </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

Aggregate functions

### ATTR

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>ATTR(expression)</code></td></tr><tr><td>Definition</td><td>Returns the value of the expression if it has a single value for all rows. Otherwise returns an asterisk. Null values are ignored.</td></tr></tbody></table>

### AVG

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>AVG(expression)</code></td></tr><tr><td>Definition</td><td>Returns the average of all the values in the expression. Null values are ignored.</td></tr><tr><td>Notes</td><td><code>AVG</code> can only be used with numeric fields.</td></tr></tbody></table>

### COLLECT

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>COLLECT(spatial)</code></td></tr><tr><td>Definition</td><td>An aggregate calculation that combines the values in the argument field. Null values are ignored.</td></tr><tr><td>Notes</td><td><code>COLLECT</code> can only be used with spatial fields.</td></tr></tbody></table>

### CORR

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>CORR(expression1, expression2)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Number from -1 to 1</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the Pearson correlation coefficient of two expressions.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>example</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>The Pearson correlation measures the linear relationship between two variables. Results range from -1 to +1 inclusive, where 1 denotes an exact positive linear relationship, 0 denotes no linear relationship between the variance, and −1 is an exact negative relationship.</p>
                                        <p>The square of a CORR result is equivalent to the R-Squared value for a linear trend line model. See <a href="https://help.tableau.com/current/pro/desktop/en-us/trendlines_add.htm#Terms" target="_blank">Trend Line Model Terms</a>.</p>
                                        <p><b>Use with table scoped LOD&nbsp;expressions:</b>
                                        </p>
                                        <p>You can use CORR to visualize correlation in a disaggregated scatter using a <a href="https://help.tableau.com/current/pro/desktop/en-us/calculations_calculatedfields_lod.htm#Table" target="_blank">table-scoped level of detail expression</a>. For example:</p><pre>{CORR(Sales, Profit)}</pre>
                                        <p>With a level of detail expression, the correlation is run over all rows. If you used a formula like <code>CORR(Sales, Profit)</code> (without the surrounding brackets to make it a level of detail expression), the view would show the correlation of each individual point in the scatter plot with each other point, which is undefined.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Database limitations</td>
                                    <td>
                                        <p><code>CORR</code> is available with the following data sources: Tableau data extracts, Cloudera Hive, EXASolution, Firebird (version 3.0 and later), Google BigQuery, Hortonworks Hadoop Hive, IBM PDA (Netezza), Oracle, PostgreSQL, Presto, SybaseIQ, Teradata, Vertica.</p>
                                        <p>For other data sources, consider either extracting the data or using <code>WINDOW_CORR</code>. See <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_tablecalculation.htm" target="_blank">Table Calculation Functions</a>.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### COUNT

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>COUNT(expression)</code></td></tr><tr><td>Definition</td><td>Returns the number of items. Null values are not counted.</td></tr></tbody></table>

### COUNTD

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>COUNTD(expression)</code></td></tr><tr><td>Definition</td><td>Returns the number of distinct items in a group. Null values are not counted.</td></tr></tbody></table>

### COVAR

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>COVAR(expression1, expression2)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the <i>sample</i> covariance of two expressions.</td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Covariance quantifies how two variables change together. A positive covariance indicates that the variables tend to move in the same direction, as when larger values of one variable tend to correspond to larger values of the other variable, on average. <i>Sample covariance</i> uses the number of non-null data points n - 1 to normalize the covariance calculation, rather than n, which is used by the population covariance (available with the <code>COVARP</code> function). Sample covariance is the appropriate choice when the data is a random sample that is being used to estimate the covariance for a larger population.</p>
                                        <p>If <code>&lt;expression1&gt;</code> and <code>&lt;expression2&gt;</code> are the same, for example <code>COVAR([profit], [profit])</code>, <code>COVAR</code> returns a value that indicates how widely values are distributed.</p>
                                        <p>The value of <code>COVAR(X, X)</code> is equivalent to the value of <code>VAR(X)</code> and also to the value of <code>STDEV(X)^2</code>.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Database limitations</td>
                                    <td>
                                        <p><code>COVAR</code> is available with the following data sources: Tableau data extracts, Cloudera Hive, EXASolution, Firebird (version 3.0 and later), Google BigQuery, Hortonworks Hadoop Hive, IBM PDA (Netezza), Oracle, PostgreSQL, Presto, SybaseIQ, Teradata, Vertica.</p>
                                        <p>For other data sources, consider either extracting the data or using <code>WINDOW_COVAR</code>. See <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_tablecalculation.htm" target="_blank">Table Calculation Functions</a>.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### COVARP

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>COVARP(expression 1, expression2)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the <i>population</i> covariance of two expressions.</td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Covariance quantifies how two variables change together. A positive covariance indicates that the variables tend to move in the same direction, as when larger values of one variable tend to correspond to larger values of the other variable, on average. <i>Population covariance</i> is sample covariance multiplied by (n-1)/n, where n is the total number of non-null data points. Population covariance is the appropriate choice when there is data available for all items of interest as opposed to when there is only a random subset of items, in which case sample covariance (with the <code>COVAR</code> function) is appropriate.
</p>
                                        <p>If <code>&lt;expression1&gt;</code> and <code>&lt;expression2&gt;</code> are the same, for example <code>COVARP([profit], [profit])</code>, <code>COVARP</code> returns a value that indicates how widely values are distributed.

Note: The value of <code>COVARP(X, X)</code> is equivalent to the value of <code>VARP(X)</code> and also to the value of <code>STDEVP(X)^2</code>.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Database limitations</td>
                                    <td>
                                        <p><code>COVARP</code> is available with the following data sources: Tableau data extracts, Cloudera Hive, EXASolution, Firebird (version 3.0 and later), Google BigQuery, Hortonworks Hadoop Hive, IBM PDA (Netezza), Oracle, PostgreSQL, Presto, SybaseIQ, Teradata, Vertica</p>
                                        <p>For other data sources, consider either extracting the data or using <code>WINDOW_COVAR</code>. See <a href="https://help.tableau.com/current/pro/desktop/en-us/functions_functions_tablecalculation.htm" target="_blank">Table Calculation Functions</a>.</p>
                                    </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>

### MEDIAN

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>MEDIAN(expression)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the median of an expression across all records. Null values are ignored.</td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td><code>MEDIAN</code> can only be used with numeric fields. </td>
                                </tr>
                                <tr>
                                    <td>Database limitations</td>
                                    <td>
                                        <p><code>MEDIAN</code> is <b>not</b> available for the following data sources: Access, Amazon Redshift, Cloudera Hadoop, HP Vertica, IBM DB2, IBM PDA (Netezza), Microsoft SQL Server, MySQL, SAP HANA, Teradata.</p>
                                        <p>For other data source types, you can extract your data into an extract file to use this function. See <a href="https://help.tableau.com/current/pro/desktop/en-us/extracting_data.htm" target="_blank">Extract Your Data</a>.</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>

### PERCENTILE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>PERCENTILE(expression, number)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the percentile value from the given expression corresponding to the specified <code>&lt;number&gt;</code>. The <code>&lt;number&gt;</code> must be between 0 and 1 (inclusive) and must be a numeric constant.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">PERCENTILE([Score], 0.9)</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Database limitations</td>
                                    <td>
                                        <p>This function is available for the following data sources:&nbsp;Non-legacy Microsoft Excel and Text File connections, Extracts and extract-only data source types (for example, Google Analytics, OData, or Salesforce), Sybase IQ 15.1 and later data sources, Oracle 10 and later data sources, Cloudera Hive and Hortonworks Hadoop Hive data sources, EXASolution 4.2 and later data sources.</p>
                                        <p>For other data source types, you can extract your data into an extract file to use this function. See <a href="https://help.tableau.com/current/pro/desktop/en-us/extracting_data.htm" target="_blank">Extract Your Data</a>.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### STDEV

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>STDEV(expression)</code></td></tr><tr><td>Definition</td><td>Returns the statistical standard deviation of all values in the given expression based on a sample of the population.</td></tr></tbody></table>

### STDEVP

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>STDEVP(expression)</code></td></tr><tr><td>Definition</td><td>Returns the statistical standard deviation of all values in the given expression based on a biased population.</td></tr></tbody></table>

### SUM

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>SUM(expression)</code></td></tr><tr><td>Definition</td><td>Returns the sum of all values in the expression. Null values are ignored.</td></tr><tr><td>Notes</td><td><code>SUM</code> can only be used with numeric fields.</td></tr></tbody></table>

### VAR

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>VAR(expression)</code></td></tr><tr><td>Definition</td><td>Returns the statistical variance of all values in the given expression based on a sample of the population.</td></tr></tbody></table>

### VARP

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>VARP(expression)</code></td></tr><tr><td>Definition</td><td>Returns the statistical variance of all values in the given expression on the entire population.</td></tr></tbody></table>

User functions

### FULLNAME( )

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>FULLNAME( )</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>	
Returns the full name for the current user. </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>FULLNAME( )</pre>
                                        <p>This returns the full name of the signed in user, such as "Hamlin Myrer".</p><pre xml:space="preserve">[Manager] = FULLNAME( )</pre>
                                        <p>If manager "Hamlin Myrer" is signed in, this example returns TRUE only if the Manager field in the view contains "Hamlin Myrer". </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>This function checks:</p>
                                        <ul>
                                            <li><span class="mc-variable Variables.TabsProductOnline variable">Tableau Cloud</span> and <span class="mc-variable Variables.TabsProductServer variable">Tableau Server</span>:&nbsp;the full name of the signed-in user</li>
                                            <li><span class="mc-variable Variables.TabsProductDesktop variable">Tableau Desktop</span>: the local or network full name for the user</li>
                                        </ul>
                                        <p><b>User filters</b>
                                        </p>
                                        <p>When used as a filter, a calculated field such as <code>[Username field] = FULLNAME( )</code> can be used to create a user filter that only shows data that is relevant to the person signed in to the server.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### ISFULLNAME

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ISFULLNAME("User Full Name")</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Returns <code>TRUE</code> if the current user's full name matches the specified full name or <code>FALSE</code> if it does not match.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>ISFULLNAME("Hamlin Myrer")</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>The <code>&lt;"User Full Name"&gt;</code> argument must be a literal string, not a field. </p>
                                        <p>This function checks:</p>
                                        <ul>
                                            <li><span class="mc-variable Variables.TabsProductOnline variable">Tableau Cloud</span> and <span class="mc-variable Variables.TabsProductServer variable">Tableau Server</span>:&nbsp;the full name of the signed-in user</li>
                                            <li><span class="mc-variable Variables.TabsProductDesktop variable">Tableau Desktop</span>: the local or network full name for the user</li>
                                        </ul>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### ISMEMBEROF

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ISMEMBEROF("Group Name")</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean or null</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Returns <code>TRUE</code> if the person currently using Tableau is a member of a group that matches the given string, <code>FALSE</code> if they're not a member, and <code>NULL</code> if they're not signed in. </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>ISMEMBEROF('Superstars')</pre><pre>ISMEMBEROF('domain.lan\Sales')</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>The <code>&lt;"Group Full Name"&gt;</code> argument must be a literal string, not a field. </p>
                                        <p>If the user is signed in to <span class="mc-variable Variables.TabsProductOnline variable">Tableau Cloud</span> or <span class="mc-variable Variables.TabsProductServer variable">Tableau Server</span>, group membership is determined by Tableau groups. The function will return TRUE if the given string is "All Users" </p>
                                        <p>The <code>ISMEMBEROF( )</code> function will also accept Active Directory domains. The Active Directory domain must be declared in the calculation with the group name.</p>
                                        <p>If a change is made to a user's group membership, the change in the data that is based on the group membership is reflected in a workbook or view with a new session. The existing session will reflect stale data.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### ISUSERNAME

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>ISUSERNAME("username")</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns <code>TRUE</code> if the current user's username matches the specified username or <code>FALSE</code> if it does not match.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">ISUSERNAME("hmyrer")</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>The <code>&lt;"username"&gt;</code> argument must be a literal string, not a field. </p>
                                        <p>This function checks:</p>
                                        <ul>
                                            <li><span class="mc-variable Variables.TabsProductOnline variable">Tableau Cloud</span> and <span class="mc-variable Variables.TabsProductServer variable">Tableau Server</span>:&nbsp;the username of the signed-in user</li>
                                            <li><span class="mc-variable Variables.TabsProductDesktop variable">Tableau Desktop</span>: the local or network username for the user</li>
                                        </ul>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### USERDOMAIN( )

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>USERDOMAIN(&nbsp;)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the domain for the current user .</td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>This function checks:</p>
                                        <ul>
                                            <li><span class="mc-variable Variables.TabsProductOnline variable">Tableau Cloud</span> and <span class="mc-variable Variables.TabsProductServer variable">Tableau Server</span>:&nbsp;the user domain of the signed-in user</li>
                                            <li><span class="mc-variable Variables.TabsProductDesktop variable">Tableau Desktop</span>: the local domain if the user is on a domain</li>
                                        </ul>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### USERNAME( )

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>USERNAME( )</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the username for the current user.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">USERNAME( )</pre>
                                        <p>This returns the username of the signed in user, such as "hmyrer".</p><pre xml:space="preserve">[Manager] = USERNAME( )</pre>
                                        <p>If manager "hmyrer" is signed in, this example returns TRUE only if the Manager field in the view contains "hmyrer". </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>This function checks:</p>
                                        <ul>
                                            <li><span class="mc-variable Variables.TabsProductOnline variable">Tableau Cloud</span> and <span class="mc-variable Variables.TabsProductServer variable">Tableau Server</span>:&nbsp;the username of the signed-in user</li>
                                            <li><span class="mc-variable Variables.TabsProductDesktop variable">Tableau Desktop</span>: the local or network username for the user</li>
                                        </ul>
                                        <p><b>User filters</b>
                                        </p>
                                        <p>When used as a filter, a calculated field such as <code>[Username field] = USERNAME( )</code> can be used to create a user filter that only shows data that is relevant to the person signed in to the server.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### USERATTRIBUTE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>USERATTRIBUTE('attribute_name')</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String or null</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>If <code>&lt;'attribute_name'&gt;</code> is part of the JWT (via connected apps, UAT, OIDC claim) or SAML&nbsp;XML&nbsp;response passed to Tableau, the calculation returns the first value of <code>&lt;'attribute_name'&gt;</code>. </p>
                                        <p>Returns null if <code>&lt;'attribute_name'&gt;</code> does not exist.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td>
                                        <p>Suppose "Region" is the user attribute  included in the JWT or SAML&nbsp;response and passed to Tableau.</p>
                                        <p> As the workbook author, you can set up your visualization to filter data based on a specified region. In that filter, you can reference the following calculation.</p><pre xml:space="preserve">[Region] = USERATTRIBUTE("Region")</pre>
                                        <p>When User2 from the West region views the embedded visualization, Tableau shows the appropriate data for the West region only.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>You can use the <code>USERATTRIBUTEINCLUDES</code> function if you expect <code>&lt;'attribute_name'&gt;</code> to return multiple values.</td>
                                </tr>
                            </tbody>
                        </table>

### USERATTRIBUTEINCLUDES

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>USERATTRIBUTEINCLUDES('attribute_name', 'expected_value')</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Boolean</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Returns <code>TRUE</code> if both of the following are true:</p>
                                        <ul>
                                            <li><code>&lt;'attribute_name'&gt;</code> is part of the  JWT (via connected app, UAT, OIDC claim) or SAML&nbsp;XML&nbsp;response passed to Tableau</li>
                                            <li>one of <code>&lt;'attribute_name'&gt;</code> values equals <code>&lt;'expected_value'&gt;</code> . </li>
                                        </ul>
                                        <p>Returns <code>FALSE</code> otherwise.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td>
                                        <p>Suppose "Region" is the user attribute  included in the JWT or SAML response&nbsp;and passed to Tableau.</p>
                                        <p> As the workbook author, you can set up your visualization to filter data based on a specified region. In that filter, you can reference the following calculation.</p><pre xml:space="preserve">USERATTRIBUTEINCLUDES('Region', [Region])</pre>
                                        <p>If User2 from the West region accesses the embedded visualization, Tableau checks if the Region user attribute matches one of [Region] field values. When true, the visualization shows the appropriate data. </p>
                                        <p>When User3 from the North region accesses the same visualization, she’s unable to see any data because there’s no match with [Region] field values.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

Table calculations

### FIRST( )

* * *

Returns the number of rows from the current row to the first row in the partition. For example, the view below shows quarterly sales. When FIRST() is computed within the Date partition, the offset of the first row from the second row is -1.

![Table calculation first.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_first.png)

#### Example

When the current row index is 3, `FIRST() = -2`.

### INDEX( )

* * *

Returns the index of the current row in the partition, without any sorting with regard to value. The first row index starts at 1. For example, the table below shows quarterly sales. When INDEX() is computed within the Date partition, the index of each row is 1, 2, 3, 4..., etc.

![Table calculation index.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_index.png)

#### Example

For the third row in the partition, `INDEX() = 3`.

### LAST( )

* * *

Returns the number of rows from the current row to the last row in the partition. For example, the table below shows quarterly sales. When LAST() is computed within the Date partition, the offset of the last row from the second row is 5.

![Table calculation last.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_last.png)

#### Example

When the current row index is 3 of 7, `LAST() = 4`.

### LOOKUP(expression, \[offset\])

* * *

Returns the value of the expression in a target row, specified as a relative offset from the current row. Use FIRST() + n and LAST() - n as part of your offset definition for a target relative to the first/last rows in the partition. If `offset` is omitted, the row to compare to can be set on the field menu. This function returns NULL if the target row cannot be determined.

The view below shows quarterly sales. When `LOOKUP (SUM(Sales), 2)` is computed within the Date partition, each row shows the sales value from 2 quarters into the future.

![Table calculation lookup.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_lookup.png)

#### Example

`LOOKUP(SUM([Profit]), FIRST()+2)` computes the SUM(Profit) in the third row of the partition.

### MODEL\_EXTENSION functions

The model extension functions:

- MODEL\_EXTENSION\_BOOL
- MODEL\_EXTENSION\_INT
- MODEL\_EXTENSION\_REAL
- MODEL\_EXTENSION\_STRING

are used to pass data to a deployed model on an external service such as R, TabPy, or Matlab. See [Analytics Extensions](https://help.tableau.com/current/pro/desktop/en-us/r_connection_manage.htm).

### MODEL\_PERCENTILE(target\_expression, predictor\_expression(s))

* * *

Returns the probability (between 0 and 1) of the expected value being less than or equal to the observed mark, defined by the target expression and other predictors. This is the Posterior Predictive Distribution Function, also known as the Cumulative Distribution Function (CDF).

This function is the inverse of MODEL\_QUANTILE. For information on predictive modeling functions, see [How Predictive Modeling Functions Work in Tableau](https://help.tableau.com/current/public/desktop/en-us/predictions_overview.htm).

#### Example

The following formula returns the quantile of the mark for sum of sales, adjusted for count of orders.

`MODEL_PERCENTILE(SUM([Sales]), COUNT([Orders]))`

### MODEL\_QUANTILE(quantile, target\_expression, predictor\_expression(s))

* * *

Returns a target numeric value within the probable range defined by the target expression and other predictors, at a specified quantile. This is the Posterior Predictive Quantile.

This function is the inverse of MODEL\_PERCENTILE. For information on predictive modeling functions, see [How Predictive Modeling Functions Work in Tableau](https://help.tableau.com/current/public/desktop/en-us/predictions_overview.htm).

#### Example

The following formula returns the median (0.5) predicted sum of sales, adjusted for count of orders.

`MODEL_QUANTILE(0.5, SUM([Sales]), COUNT([Orders]))`

### PREVIOUS\_VALUE(expression)

* * *

Returns the value of this calculation in the previous row. Returns the given expression if the current row is the first row of the partition.

#### Example

`SUM([Profit]) * PREVIOUS_VALUE(1)` computes the running product of SUM(Profit).

### RANK(expression, \['asc' | 'desc'\])

* * *

Returns the standard competition rank for the current row in the partition. Identical values are assigned an identical rank. Use the optional `'asc' | 'desc'` argument to specify ascending or descending order. The default is descending.

With this function, the set of values (6, 9, 9, 14) would be ranked (4, 2, 2, 1).

Nulls are ignored in ranking functions. They are not numbered and they do not count against the total number of records in percentile rank calculations.

For information on different ranking options, see [Rank calculation](https://help.tableau.com/current/public/desktop/en-us/calculations_tablecalculations_definebasic_runningtotal.htm#Rank).

#### Example

The following image shows the effect of the various ranking functions (RANK, RANK\_DENSE, RANK\_MODIFIED, RANK\_PERCENTILE, and RANK\_UNIQUE) on a set of values. The data set contains information on 14 students (Student A through Student N); the Age column shows the current age of each student (all students are between 17 and 20 years of age). The remaining columns show the effect of each rank function on the set of age values, always assuming the default order (ascending or descending) for the function.

![A table comparing the rank of student ages using different ranking methods.](/tableau/current/en-us/public/desktop/en-us/Img/rank_compare.png)

### RANK\_DENSE(expression, \['asc' | 'desc'\])

* * *

Returns the dense rank for the current row in the partition. Identical values are assigned an identical rank, but no gaps are inserted into the number sequence. Use the optional `'asc' | 'desc'` argument to specify ascending or descending order. The default is descending.

With this function, the set of values (6, 9, 9, 14) would be ranked (3, 2, 2, 1).

Nulls are ignored in ranking functions. They are not numbered and they do not count against the total number of records in percentile rank calculations.

For information on different ranking options, see [Rank calculation](https://help.tableau.com/current/public/desktop/en-us/calculations_tablecalculations_definebasic_runningtotal.htm#Rank).

### RANK\_MODIFIED(expression, \['asc' | 'desc'\])

* * *

Returns the modified competition rank for the current row in the partition. Identical values are assigned an identical rank. Use the optional `'asc' | 'desc'` argument to specify ascending or descending order. The default is descending.

With this function, the set of values (6, 9, 9, 14) would be ranked (4, 3, 3, 1).

Nulls are ignored in ranking functions. They are not numbered and they do not count against the total number of records in percentile rank calculations.

For information on different ranking options, see [Rank calculation](https://help.tableau.com/current/public/desktop/en-us/calculations_tablecalculations_definebasic_runningtotal.htm#Rank).

### RANK\_PERCENTILE(expression, \['asc' | 'desc'\])

* * *

Returns the percentile rank for the current row in the partition. Use the optional `'asc' | 'desc'` argument to specify ascending or descending order. The default is ascending.

With this function, the set of values (6, 9, 9, 14) would be ranked (0.00, 0.67, 0.67, 1.00).

Nulls are ignored in ranking functions. They are not numbered and they do not count against the total number of records in percentile rank calculations.

For information on different ranking options, see [Rank calculation](https://help.tableau.com/current/public/desktop/en-us/calculations_tablecalculations_definebasic_runningtotal.htm#Rank).

### RANK\_UNIQUE(expression, \['asc' | 'desc'\])

* * *

Returns the unique rank for the current row in the partition. Identical values are assigned different ranks. Use the optional `'asc' | 'desc'` argument to specify ascending or descending order. The default is descending.

With this function, the set of values (6, 9, 9, 14) would be ranked (4, 2, 3, 1).

Nulls are ignored in ranking functions. They are not numbered and they do not count against the total number of records in percentile rank calculations.

For information on different ranking options, see [Rank calculation](https://help.tableau.com/current/public/desktop/en-us/calculations_tablecalculations_definebasic_runningtotal.htm#Rank).

### RUNNING\_AVG(expression)

* * *

Returns the running average of the given expression, from the first row in the partition to the current row.

The view below shows quarterly sales. When `RUNNING_AVG(SUM([Sales])` is computed within the Date partition, the result is a running average of the sales values for each quarter.

![Table calculation with a running average.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_runningavg.png)

#### Example

`RUNNING_AVG(SUM([Profit]))` computes the running average of SUM(Profit).

### RUNNING\_COUNT(expression)

* * *

Returns the running count of the given expression, from the first row in the partition to the current row.

#### Example

`RUNNING_COUNT(SUM([Profit]))` computes the running count of SUM(Profit).

### RUNNING\_MAX(expression)

* * *

Returns the running maximum of the given expression, from the first row in the partition to the current row.

![Table calculation with a running max.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_runningmax.png)

#### Example

`RUNNING_MAX(SUM([Profit]))` computes the running maximum of SUM(Profit).

### RUNNING\_MIN(expression)

* * *

Returns the running minimum of the given expression, from the first row in the partition to the current row.

![Table calculation with a running min.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_runningmin.png)

#### Example

`RUNNING_MIN(SUM([Profit]))` computes the running minimum of SUM(Profit).

### RUNNING\_SUM(expression)

* * *

Returns the running sum of the given expression, from the first row in the partition to the current row.

![Table calculation with a running sum.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_runningsum.png)

#### Example

`RUNNING_SUM(SUM([Profit]))` computes the running sum of SUM(Profit)

### SIZE()

* * *

Returns the number of rows in the partition. For example, the view below shows quarterly sales. Within the Date partition, there are seven rows so the Size() of the Date partition is 7.

![Table calculation size.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_size.png)

#### Example

`SIZE() = 5` when the current partition contains five rows.

### SCRIPT\_ functions

The script functions:

- SCRIPT\_BOOL
- SCRIPT\_INT
- SCRIPT\_REAL
- SCRIPT\_STRING

are used to pass data to an external service such as R, TabPy, or Matlab. See [Analytics Extensions](https://help.tableau.com/current/pro/desktop/en-us/r_connection_manage.htm).

### TOTAL(expression)

* * *

Returns the total for the given expression in a table calculation partition.

#### Example

Assume you are starting with this view:

![Table calculation total.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total.png)

You open the calculation editor and create a new field which you name Totality:

![Table calculation of total sum of sales.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total2.png)

You then drop Totality on Text, to replace SUM(Sales). Your view changes such that it sums values based on the default Compute Using value:

![Table calculation added to a viz.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total3.png)

This raises the question, What is the default Compute Using value? If you right-click (Control-click on a Mac) Totality in the Data pane and choose Edit, there is now an additional bit of information available:

![Table calculation of total sum of sales.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total4.png)

The default Compute Using value is Table (Across). The result is that Totality is summing the values across each row of your table. Thus, the value that you see across each row is the sum of the values from the original version of the table.

The values in the 2011/Q1 row in the original table were $8601, $6579, $44262, and $15006. The values in the table after Totality replaces SUM(Sales) are all $74,448, which is the sum of the four original values.

Notice the triangle next to Totality after you drop it on Text:

![Table calculation added to a viz and shown on the Marks card.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total5.png)

This indicates that this field is using a table calculation. You can right-click the field and choose Edit Table Calculation to redirect your function to a different Compute Using value. For example, you could set it to Table (Down). In that case, your table would look like this:

![Table calculation added to a viz and shown on the Marks card.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total6.png)

### TOTAL(expression)

* * *

Returns the total for the given expression in a table calculation partition.

#### Example

Assume you are starting with this view:

![Table calculation total.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total.png)

You open the calculation editor and create a new field which you name Totality:

![Table calculation of total sum of sales.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total2.png)

You then drop Totality on Text, to replace SUM(Sales). Your view changes such that it sums values based on the default Compute Using value:

![Table calculation added to a viz.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total3.png)

This raises the question, What is the default Compute Using value? If you right-click (Control-click on a Mac) Totality in the Data pane and choose Edit, there is now an additional bit of information available:

![Table calculation of total sum of sales.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total4.png)

The default Compute Using value is Table (Across). The result is that Totality is summing the values across each row of your table. Thus, the value that you see across each row is the sum of the values from the original version of the table.

The values in the 2011/Q1 row in the original table were $8601, $6579, $44262, and $15006. The values in the table after Totality replaces SUM(Sales) are all $74,448, which is the sum of the four original values.

Notice the triangle next to Totality after you drop it on Text:

![Table calculation added to a viz and shown on the Marks card.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total5.png)

This indicates that this field is using a table calculation. You can right-click the field and choose Edit Table Calculation to redirect your function to a different Compute Using value. For example, you could set it to Table (Down). In that case, your table would look like this:

![Table calculation added to a viz and shown on the Marks card.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_total6.png)

### WINDOW\_AVG(expression, \[start, end\])

* * *

Returns the average of the expression within the window. The window is defined as offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If start and end are omitted, the entire partition is used.

There is an equivalent aggregation function: AVG. See [Tableau Functions (Alphabetical)](https://help.tableau.com/current/public/desktop/en-us/functions_all_alphabetical.htm).

#### Example

The following formula returns the window average of **SUM(Profit)** from the two previous rows to the current row.

`WINDOW_AVG(SUM[Profit]), -2, 0)`

### WINDOW\_CORR(expression1, expression2, \[start, end\])

* * *

Returns the Pearson correlation coefficient of two expressions within the window. The window is defined as offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If start and end are omitted, the entire partition is used.

The Pearson correlation measures the linear relationship between two variables. Results range from -1 to +1 inclusive, where 1 denotes an exact positive linear relationship, as when a positive change in one variable implies a positive change of corresponding magnitude in the other, 0 denotes no linear relationship between the variance, and −1 is an exact negative relationship.

There is an equivalent aggregation fuction: CORR. See [Tableau Functions (Alphabetical)](https://help.tableau.com/current/public/desktop/en-us/functions_all_alphabetical.htm).

#### Example

The following formula returns the Pearson correlation of SUM(Profit) and SUM(Sales) from the five previous rows to the current row.

`WINDOW_CORR(SUM[Profit]), SUM([Sales]), -5, 0)`

### WINDOW\_COUNT(expression, \[start, end\])

* * *

Returns the count of the expression within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

#### Example

`WINDOW_COUNT(SUM([Profit]), FIRST()+1, 0)` computes the count of SUM(Profit) from the second row to the current row

### WINDOW\_COVAR(expression1, expression2, \[start, end\])

* * *

Returns the _sample covariance_ of two expressions within the window. The window is defined as offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end arguments are omitted, the window is the entire partition.

Sample covariance uses the number of non-null data points n - 1 to normalize the covariance calculation, rather than n, which is used by the population covariance (with the WINDOW\_COVARP function). Sample covariance is the appropriate choice when the data is a random sample that is being used to estimate the covariance for a larger population.

There is an equivalent aggregation fuction: COVAR. See [Tableau Functions (Alphabetical)](https://help.tableau.com/current/public/desktop/en-us/functions_all_alphabetical.htm).

#### Example

The following formula returns the sample covariance of SUM(Profit) and SUM(Sales) from the two previous rows to the current row.

`WINDOW_COVAR(SUM([Profit]), SUM([Sales]), -2, 0)`

### WINDOW\_COVARP(expression1, expression2, \[start, end\])

* * *

Returns the _population covariance_ of two expressions within the window. The window is defined as offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If start and end are omitted, the entire partition is used.

Population covariance is sample covariance multiplied by (n-1)/n, where n is the total number of non-null data points. Population covariance is the appropriate choice when there is data available for all items of interest as opposed to when there is only a random subset of items, in which case sample covariance (with the WINDOW\_COVAR function) is appropriate.

There is an equivalent aggregation fuction: COVARP. [Tableau Functions (Alphabetical)](https://help.tableau.com/current/public/desktop/en-us/functions_all_alphabetical.htm).

#### Example

The following formula returns the population covariance of SUM(Profit) and SUM(Sales) from the two previous rows to the current row.

`WINDOW_COVARP(SUM([Profit]), SUM([Sales]), -2, 0)`

### WINDOW\_MEDIAN(expression, \[start, end\])

* * *

Returns the median of the expression within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

For example, the view below shows quarterly profit. A window median within the Date partition returns the median profit across all dates.

![Table calculation with a window median operator.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_windowmedian.png)

#### Example

`WINDOW_MEDIAN(SUM([Profit]), FIRST()+1, 0)` computes the median of SUM(Profit) from the second row to the current row.

### WINDOW\_MAX(expression, \[start, end\])

* * *

Returns the maximum of the expression within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

For example, the view below shows quarterly sales. A window maximum within the Date partition returns the maximum sales across all dates.

![Table calculation with a window max operator.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_windowmax.png)

#### Example

`WINDOW_MAX(SUM([Profit]), FIRST()+1, 0)` computes the maximum of SUM(Profit) from the second row to the current row.

### WINDOW\_MIN(expression, \[start, end\])

* * *

Returns the minimum of the expression within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

For example, the view below shows quarterly sales. A window minimum within the Date partition returns the minimum sales across all dates.

![Table calculation with a window min operator.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_windowmin.png)

#### Example

`WINDOW_MIN(SUM([Profit]), FIRST()+1, 0)` computes the minimum of SUM(Profit) from the second row to the current row.

### WINDOW\_PERCENTILE(expression, number, \[start, end\])

* * *

Returns the value corresponding to the specified percentile within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

#### Example

`WINDOW_PERCENTILE(SUM([Profit]), 0.75, -2, 0)` returns the 75th percentile for SUM(Profit) from the two previous rows to the current row.

### WINDOW\_STDEV(expression, \[start, end\])

* * *

Returns the sample standard deviation of the expression within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

#### Example

`WINDOW_STDEV(SUM([Profit]), FIRST()+1, 0)` computes the standard deviation of SUM(Profit) from the second row to the current row.

### WINDOW\_STDEVP(expression, \[start, end\])

* * *

Returns the biased standard deviation of the expression within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

#### Example

`WINDOW_STDEVP(SUM([Profit]), FIRST()+1, 0)` computes the standard deviation of SUM(Profit) from the second row to the current row.

### WINDOW\_SUM(expression, \[start, end\])

* * *

Returns the sum of the expression within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

For example, the view below shows quarterly sales. A window sum computed within the Date partition returns the summation of sales across all quarters.

![Table calculation with a window sum operator.](/tableau/current/en-us/public/desktop/en-us/Img/tablecalc_windowsum.png)

#### Example

`WINDOW_SUM(SUM([Profit]), FIRST()+1, 0)` computes the sum of SUM(Profit) from the second row to the current row.

### WINDOW\_VAR(expression, \[start, end\])

* * *

Returns the sample variance of the expression within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

#### Example

`WINDOW_VAR((SUM([Profit])), FIRST()+1, 0)` computes the variance of SUM(Profit) from the second row to the current row.

### WINDOW\_VARP(expression, \[start, end\])

* * *

Returns the biased variance of the expression within the window. The window is defined by means of offsets from the current row. Use FIRST()+n and LAST()-n for offsets from the first or last row in the partition. If the start and end are omitted, the entire partition is used.

#### Example

`WINDOW_VARP(SUM([Profit]), FIRST()+1, 0)` computes the variance of SUM(Profit) from the second row to the current row.

Pass-Through functions (RAWSQL)

These RAWSQL pass-through functions send SQL expressions directly to the database, without first being interpreted by Tableau. If you have custom database functions that Tableau doesn't know about, you can use pass-through functions to call these custom functions.

Because Tableau doesn't interpret the expression, you must define the aggregation when necessary. You can use the `RAWSQLAGG` version of a function when you need to pass an aggregated expression.

RAWSQL pass-through functions may not work with federated (combined across different databases) or published data sources.

## RAWSQL Syntax

RAWSQL functions have two types, disaggregated and aggregated. This is specified in the first part of the function name, _RAWSQL_ or _RAWSQLAGG_. The final portion of the function name is the output type, such as _BOOL_, _STR_, or _INT_. In all RAWSQL functions, the argument is `"sql_expr", [arg1], ...[arg2]`. When writing the function, you can use a substitution syntax `%n` to insert the correct field name or expression.

### %n substitution syntax

Your database won't usually understand the field names that are shown in Tableau. Because Tableau doesn't interpret the SQL expressions in the pass-through functions, using the Tableau field names in your expression may cause errors. Use `%n` to insert the correct field name or expression for a Tableau calculation into pass-through SQL.

For example, if you had a function that computed the median of a set of values, you could call that function on the Tableau column \[Sales\] like this:

RAWSQLAGG\_REAL("MEDIAN(%1)", \[Sales\])

- `REALSQLAGG` because you want to specify the aggregation.
- `REAL` because the output is numeric and not necessarily an integer.
- `MEDIAN` is the aggregation.
- `%1` is the placeholder for `[Sales]`.

## RAWSQL Functions

The SQL expression is passed directly to the underlying database. Use %n in the SQL expression as a substitution syntax for database values.

The following RAWSQL functions are available in Tableau:

### RAWSQL\_BOOL

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQL_BOOL("sql_expr", [arg1], …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Boolean</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a Boolean result from a given SQL expression.</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQL_BOOL("%1 &gt; %2", [Sales], [Profit])</pre>
                                            <p>In the example, %1 is equal to [Sales] and %2 is equal to [Profit].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQLAGG\_BOOL

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQLAGG_BOOL("sql_expr", [arg1], …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Boolean</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a Boolean result from a given aggregate SQL expression. </td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQLAGG_BOOL("SUM( %1) &gt;SUM( %2)", [Sales], [Profit]) </pre>
                                            <p>In the example,  %1 is equal to [Sales] and %2 is equal to [Profit].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQL\_DATE

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQL_DATE("sql_expr", [arg1], …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Date</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a date result from a given SQL expression.</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQL_DATE("%1", [Order Date])</pre>
                                            <p>In this example, %1 is equal to [Order Date].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQLAGG\_DATE

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQLAGG_DATE("sql_expr", [arg1], …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Date</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a date result from a given aggregate SQL expression</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQLAGG_DATE("MAX(%1)", [Order Date])</pre>
                                            <p>In this example, %1 is equal to [Order Date].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQL\_DATETIME

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQL_DATETIME("sql_expr", [arg1], …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Datetime</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a datetime result from a given SQL expression. </td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQL_DATETIME("%1", [Order Date])</pre>
                                            <p>In this example, %1 is equal to [Order Date].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQLAGG\_DATETIME

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQLAGG_DATETIME("sql_expr", [arg1], …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Datetime</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a datetime result from a given aggregate SQL expression.</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQLAGG_DATETIME("MIN(%1)", [Order Date])</pre>
                                            <p>In this example, %1 is equal to [Order Date].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQL\_INT

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQL_INT("sql_expr", [arg1], …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Integer</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns an integer result from a given SQL expression.</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQL_INT("500 + %1", [Sales])</pre>
                                            <p>In this example, %1 is equal to [Sales].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQLAGG\_INT

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQLAGG_INT("sql_expr", [arg1,] …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Integer</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns an integer result from a given aggregate SQL expression.</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQLAGG_INT("500 + SUM(%1)", [Sales])</pre>
                                            <p>In this example, %1 is equal to [Sales].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQL\_REAL

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQL_REAL("sql_expr", [arg1], …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Numeric</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a numeric result from a given SQL expression.</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre>RAWSQL_REAL("-123.98 * %1", [Sales])</pre>
                                            <p>In this example, %1 is equal to [Sales]</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQLAGG\_REAL

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQLAGG_REAL("sql_expr", [arg1,] …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Numeric</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a numeric result from a given aggregate SQL expression.</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQLAGG_REAL("SUM( %1)", [Sales])</pre>
                                            <p>In this example, %1 is equal to [Sales].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQL\_SPATIAL

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQL_SPATIAL("sql_expr", [arg1], …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>Spatial</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a spatial result from a given SQL expression.</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQL_SPATIAL("%1", [Geometry])</pre>
                                            <p>In this example, %1 is equal to [Geometry].</p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Note</td>
                                        <td>There is no <code>RAWSQLAGG</code> version of this function.</td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQL\_STR

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQL_STR("sql_expr", [arg1], …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>String</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a string from a given SQL expression.</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQL_STR("%1", [Customer Name])</pre>
                                            <p>In this example, %1 is equal to [Customer Name].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

### RAWSQLAGG\_STR

<table class="table--plain" style="width: 100%;">
                                <colgroup><col style="width: 20%;">
                                <col>
                                </colgroup><tbody>
                                    <tr>
                                        <td>Syntax</td>
                                        <td><code>RAWSQLAGG_STR("sql_expr", [arg1,] …[argN])</code>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Output</td>
                                        <td>String</td>
                                    </tr>
                                    <tr>
                                        <td>Definition</td>
                                        <td>Returns a string from a given aggregate SQL expression.</td>
                                    </tr>
                                    <tr>
                                        <td>Example</td>
                                        <td><pre xml:space="preserve">RAWSQLAGG_STR("AVG(%1)", [Discount])</pre>
                                            <p>In this example, %1 is equal to [Discount].</p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

Spatial functions

Spatial functions allow you to perform advanced spatial analysis and combine spatial files with data in other formats like text files or spreadsheets.

### AREA

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>AREA(Spatial Polygon, 'units')</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Number</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the total surface area of a <code>&lt;spatial polygon&gt;</code>.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">AREA([Geometry], 'feet')</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Supported unit names (must be in quotation marks in the calculation, such as <code>'miles'</code>):
                        </p><ul><li><i>meters</i>: meters, metres, m</li><li><i>kilometers</i>: kilometers, kilometres, km</li><li><i>miles</i>: miles, mi</li><li><i>feet</i>: feet, ft</li></ul><p></p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### BUFFER

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>BUFFER(Spatial point, distance, 'units')</code>
                                        <p><code>BUFFER(Spatial linestring, distance, 'units')</code>
                                        </p>
                                        <p><code>BUFFER(Spatial polygon, distance, 'units')</code>
                                        </p>
                                        <ul>
                                            <li><i>meters</i>: meters, metres, m</li>
                                            <li><i>kilometers</i>: kilometers, kilometres, km</li>
                                            <li><i>miles</i>: miles, mi</li>
                                            <li><i>feet</i>: feet, ft</li>
                                        </ul>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Geometry</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>For spatial points, returns a polygon shape centered over a <code>&lt;spatial point&gt;</code>, with a radius determined by the <code>&lt;distance&gt;</code> and <code>&lt;unit&gt;</code> values.</p>
                                        <p>For linestrings, computes the polygons formed by including all points within the radius distance from the linestring.</p>
                                        <p>For polygons, calculates a polygon that is either an inset (negative distance) or outset (positive distance) of each given polygon.</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">BUFFER([Spatial Point Geometry], 25, 'mi')</pre><pre xml:space="preserve">BUFFER(MAKEPOINT(47.59, -122.32), 3, 'km')</pre><pre xml:space="preserve">BUFFER(MAKELINE(MAKEPOINT(0, 20),MAKEPOINT (30, 30)),20,'km'))</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Supported unit names (must be in quotation marks in the calculation, such as <code>'miles'</code>):
                        </p>
                                        <ul>
                                            <li><i>meters</i>: meters, metres, m</li>
                                            <li><i>kilometers</i>: kilometers, kilometres, km</li>
                                            <li><i>miles</i>: miles, mi                           </li>
                                            <li><i>feet</i>: feet, ft</li>
                                        </ul>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### DIFFERENCE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>DIFFERENCE(Spatial, Spatial)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Spatial Polygon</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Computes the portions of regions remaining when all regions in the second argument are carved out of the first argument in areas that overlap. Discards regions from the second argument in areas that don't overlap.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">DIFFERENCE(Spatial Polygon1, Spatial Polygon2)</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Supports spatial polygons and multipolygons, not spatial points or lines.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### DISTANCE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>DISTANCE(SpatialPoint1, SpatialPoint2, 'units')</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Number</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the distance measurement between two points in the specified <code>&lt;unit&gt;</code>. </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>DISTANCE([Origin Point],[Destination Point], 'km')</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Supported unit names (must be in quotation marks in the calculation, such as <code>'miles'</code>):
                        </p>
                                        <ul>
                                            <li><i>meters</i>: meters, metres, m</li>
                                            <li><i>kilometers</i>: kilometers, kilometres, km</li>
                                            <li><i>miles</i>: miles, mi</li>
                                            <li><i>feet</i>: feet, ft</li>
                                        </ul>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Database limitations</td>
                                    <td>This function can only be created with a live connection but will continue to work if the data source is converted to an extract.</td>
                                </tr>
                            </tbody>
                        </table>

### INTERSECTION

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>INTERSECTION (spatial, spatial)</code></td></tr><tr><td>Output</td><td>Polygon</td></tr><tr><td>Definition</td><td>Computes and returns the portions of regions in the second argument that overlap regions in the first argument.</td></tr><tr><td>Example</td><td><tt>INTERSECTION (Spatial Polygon1, Spatial Polygon2)</tt></td></tr><tr><td>Notes</td><td>Supports spatial polygons and multipolygons, not spatial points or lines.</td></tr></tbody></table>

### INTERSECTS

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"> <col></colgroup><tbody><tr><td>Syntax</td><td><code>INTERSECTS (geometry1, geometry2)</code></td></tr><tr><td>Output</td><td>Boolean</td></tr><tr><td>Definition</td><td>Returns true or false indicating if two geometries overlap in space.</td></tr><tr><td>Notes</td><td>Supported combinations: point/polygon, line/polygon, and polygon/polygon.</td></tr></tbody></table>

### LENGTH

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>LENGTH(geometry, 'units')</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Number</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns the geodetic path length of the line string or strings in the <code>&lt;geometry&gt;</code> using the given <code>&lt;units&gt;</code>. </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">LENGTH([Spatial], 'metres')</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>The result is <code>&lt;NaN&gt;</code> if the geometry argument has no linestrings, though other elements are permitted. </td>
                                </tr>
                            </tbody>
                        </table>

### MAKELINE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>MAKELINE(SpatialPoint1, SpatialPoint2)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Geometry (line)</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Generates a line mark between two points</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>MAKELINE(MAKEPOINT(47.59, -122.32), MAKEPOINT(48.5, -123.1))</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>Useful for building origin-destination maps.</td>
                                </tr>
                            </tbody>
                        </table>

### MAKEPOINT

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>MAKEPOINT(latitude, longitude, [SRID])</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Geometry (point)</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>
                                        <p>Converts data from <code>&lt;latitude&gt;</code> and <code>&lt;longitude&gt;</code> columns into spatial objects.</p>
                                        <p>If the optional <code>&lt;SRID&gt;</code> argument is added, the inputs can be other projected geographic coordinates. </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre>MAKEPOINT(48.5, -123.1)</pre><pre xml:space="preserve">MAKEPOINT([AirportLatitude], [AirportLongitude])</pre><pre xml:space="preserve">MAKEPOINT([Xcoord],[Ycoord], 3493)</pre>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p><code>MAKEPOINT</code> can't use the automatically generated latitude and longitude fields. The data source must contain the  coordinates natively. </p>
                                        <p><code>SRID</code> is a spatial reference identifier that uses <a href="https://epsg.io/" target="_blank">ESPG reference system codes</a> to specify coordinate systems. If <code>SRID</code> is not specified, WGS84 is assumed and parameters are treated as latitude/longitude in degrees.</p>
                                        <p>You can use <code>MAKEPOINT</code> to spatially-enable a data source so that it can be joined with a spatial file using a spatial join. For more information, see <a href="https://help.tableau.com/current/public/desktop/en-us/maps_spatial_join.htm" class="xref">Join Spatial Files in Tableau </a>.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### NO\_CUTOUTS

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>NO_CUTOUTS (spatial)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Corrected spatial polygon</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns a corrected spatial polygon if a flat-earth interpretation requires polygon inversions; otherwise, returns the original.</td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Spatial file formats like Keyhole Markup Language (.kml) require polygon boundaries to follow a specific coordinate direction. If a data set draws boundaries in reverse, Tableau interprets the exterior space as the shape. <code>NO_CUTOUTS</code> reorders these coordinates to restore the correct layout.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### OUTLINE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>OUTLINE(spatial polygon)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Geometry</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Converts a polygon geometry into linestrings. </td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Useful for creating a separate layer for an outline that can be styled differently than the fill.</p>
                                        <p>Supports polygons within multipolygons.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### PARSE\_WKT

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>PARSE_WKT (String)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Spatial (Geography)</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Converts a text string field containing well-known text (WKT) representations of geographic entities (such as points, linestrings, or polygons) into a spatial value.
</td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>Coordinates are assumed to use WGS-84 latitude and longitude.
For more information about WKT, see <a href="https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry">Well-Known Text Representation of Geometry</a>.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### SHAPETYPE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>SHAPETYPE(geometry)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>String</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Returns a string describing the structure of the spatial <code>&lt;geometry&gt;</code>, such as Empty, Point, MultiPoint, LineString, MultiLinestring, Polygon, MultiPolygon, Mixed, and unsupported.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td><pre xml:space="preserve">SHAPETYPE(MAKEPOINT(48.5, -123.1)) = "Point"</pre>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### SYMDIFFERENCE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>SYMDIFFERENCE(spatial, spatial)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Geometry</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Computes any portions of regions from the second argument that overlap regions in the first argument and discards from both. Returns the remaining portions of regions from both arguments.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td>
                                        <p><code>SYMDIFFERENCE(Spatial Polygon1, Spatial Polygon2)</code>
                                        </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### UNION

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>UNION(spatial 1, [spatial 2])</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Geometry</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Combines spatial geometries by dissolving adjacent or overlapping boundaries into a single spatial geometry.</td>
                                </tr>
                                <tr>
                                    <td>Notes</td>
                                    <td>
                                        <p>When used with one argument (<code>UNION(spatial)</code>), <code>UNION </code>acts as an aggregate function that merges all spatial objects in a field across rows.</p>
                                        <p>When used with two arguments (<code>UNION(spatial1, spatial2)</code>), <code>UNION </code>merges two distinct spatial fields or geometries.</p>
                                        <p>For points and linestrings, <code>UNION </code>combines all elements into a single collection. For polygons, overlapping or touching shapes dissolve into a single polygon or multipolygon.</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

### VALIDATE

<table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 20%;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>Syntax</td>
                                    <td><code>VALIDATE(spatial geometry)</code>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Output</td>
                                    <td>Geometry</td>
                                </tr>
                                <tr>
                                    <td>Definition</td>
                                    <td>Confirms topological correctness of the geometry in your spatial value. If the value cannot be used for analysis due to problems such as a polygon’s perimeter intersecting itself, then the result will be a null. If the geometry is correct, the result will be the original geometry.</td>
                                </tr>
                                <tr>
                                    <td>Example</td>
                                    <td>
                                        <p><code>UNION(VALIDATE([Geometry]))</code>
                                        </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

Additional functions

See also: [Pass-Through Functions (RAWSQL)](https://help.tableau.com/current/pro/desktop/en-us/functions_functions_passthrough.htm).

## Regular Expressions 

For information on regular expression syntax, see your data source's documentation. For Tableau extracts, regular expression syntax conforms to the standards of the ICU (International Components for Unicode), an open source project of mature C/C++ and Java libraries for Unicode support, software internationalization, and software globalization. See the [Regular Expressions](http://userguide.icu-project.org/strings/regexp) page in the online ICU User Guide.

### REGEXP\_REPLACE

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>REGEXP_REPLACE(string, pattern, replacement)</code></td></tr><tr><td>Output</td><td>String</td></tr><tr><td>Definition</td><td>Returns a copy of the given string where the regular expression pattern is replaced by the replacement string. </td></tr><tr><td>Example</td><td><pre>REGEXP_REPLACE('abc 123', '\s', '-') = 'abc-123'</pre></td></tr><tr><td>Notes</td><td><p>This function is available for Text File, Hadoop Hive, Google BigQuery, PostgreSQL, Tableau Data Extract, Microsoft Excel, Salesforce, Vertica, Pivotal Greenplum, Teradata (version 14.1 and above), Snowflake, and Oracle data sources. </p><p>For Tableau data extracts, the pattern and the replacement must be constants. </p></td></tr></tbody></table>

### REGEXP\_MATCH

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>REGEXP_MATCH(string, pattern)</code></td></tr><tr><td>Output</td><td>Boolean</td></tr><tr><td>Definition</td><td>Returns true if a substring of the specified string matches the regular expression pattern.</td></tr><tr><td>Example</td><td><pre>REGEXP_MATCH('-([1234].[The.Market])-','\[\s*(\w*\.)(\w*\s*\])')=true</pre></td></tr><tr><td>Notes</td><td><p> This function is available for Text File, Google BigQuery, PostgreSQL, Tableau Data Extract, Microsoft Excel, Salesforce, Vertica, Pivotal Greenplum, Teradata (version 14.1 and above), Impala 2.3.0 (through Cloudera Hadoop data sources), Snowflake, and Oracle data sources. </p><p>For Tableau data extracts, the pattern must be a constant. </p></td></tr></tbody></table>

### REGEXP\_EXTRACT

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>REGEXP_EXTRACT(string, pattern)</code></td></tr><tr><td>Output</td><td>String</td></tr><tr><td>Definition</td><td>Returns the portion of the string that matches the regular expression pattern. </td></tr><tr><td>Example</td><td><pre>REGEXP_EXTRACT('abc 123', '[a-z]+\s+(\d+)') = '123'</pre></td></tr><tr><td>Notes</td><td><p> This function is available for Text File, Hadoop Hive, Google BigQuery, PostgreSQL, Tableau Data Extract, Microsoft Excel, Salesforce, Vertica, Pivotal Greenplum, Teradata (version 14.1 and above), Snowflake, and Oracle data sources. </p><p>For Tableau data extracts, the pattern must be a constant. </p></td></tr></tbody></table>

### REGEXP\_EXTRACT\_NTH

<table class="table--plain" style="width: 100%;"><colgroup><col style="width: 20%;"><col></colgroup><tbody><tr><td>Syntax</td><td><code>REGEXP_EXTRACT_NTH(string, pattern, index)</code></td></tr><tr><td>Output</td><td>String</td></tr><tr><td>Definition</td><td>Returns the portion of the string that matches the regular expression pattern. The substring is matched to the nth capturing group, where n is the given index. If index is 0, the entire string is returned. </td></tr><tr><td>Example</td><td><pre>REGEXP_EXTRACT_NTH('abc 123', '([a-z]+)\s+(\d+)', 2) = '123'</pre></td></tr><tr><td>Notes</td><td><p>This function is available for Text File, PostgreSQL, Tableau Data Extract, Microsoft Excel, Salesforce, Vertica, Pivotal Greenplum, Teradata (version 14.1 and above), and Oracle data sources.</p><p>For Tableau data extracts, the pattern must be a constant. </p></td></tr></tbody></table>

## Hadoop Hive Specific Functions

**Note**: Only the PARSE\_URL and PARSE\_URL\_QUERY functions are available for Cloudera Impala data sources.

### GET\_JSON\_OBJECT(JSON string, JSON path)

Returns the JSON object within the JSON string based on the JSON path.

### PARSE\_URL(string, url\_part)

Returns a component of the given URL string where the component is defined by url\_part. Valid url\_part values include: 'HOST', 'PATH', 'QUERY', 'REF', 'PROTOCOL', 'AUTHORITY', 'FILE' and 'USERINFO'.

Example

`PARSE_URL('http://www.tableau.com', 'HOST') = 'www.tableau.com'`

### PARSE\_URL\_QUERY(string, key)

Returns the value of the specified query parameter in the given URL string. The query parameter is defined by the key.

Example

`PARSE_URL_QUERY('http://www.tableau.com?page=1&cat=4', 'page') = '1'`

### XPATH\_BOOLEAN(XML string, XPath expression string)

Returns true if the XPath expression matches a node or evaluates to true.

Example

`XPATH_BOOLEAN('<values> <value id="0">1</value><value id="1">5</value>', 'values/value[@id="1"] = 5') = true`

### XPATH\_DOUBLE(XML string, XPath expression string)

Returns the floating-point value of the XPath expression.

Example

`XPATH_DOUBLE('<values><value>1.0</value><value>5.5</value> </values>', 'sum(value/*)') = 6.5`

### XPATH\_FLOAT(XML string, XPath expression string)

Returns the floating-point value of the XPath expression.

Example

`XPATH_FLOAT('<values><value>1.0</value><value>5.5</value> </values>','sum(value/*)') = 6.5`

### XPATH\_INT(XML string, XPath expression string)

Returns the numerical value of the XPath expression, or zero if the XPath expression cannot evaluate to a number.

Example

`XPATH_INT('<values><value>1</value><value>5</value> </values>','sum(value/*)') = 6`

### XPATH\_LONG(XML string, XPath expression string)

Returns the numerical value of the XPath expression, or zero if the XPath expression cannot evaluate to a number.

Example

`XPATH_LONG('<values><value>1</value><value>5</value> </values>','sum(value/*)') = 6`

### XPATH\_SHORT(XML string, XPath expression string)

Returns the numerical value of the XPath expression, or zero if the XPath expression cannot evaluate to a number.

Example

`XPATH_SHORT('<values><value>1</value><value>5</value> </values>','sum(value/*)') = 6`

### XPATH\_STRING(XML string, XPath expression string)

Returns the text of the first matching node.

Example

`XPATH_STRING('<sites ><url domain="org">http://www.w3.org</url> <url domain="com">http://www.tableau.com</url></sites>', 'sites/url[@domain="com"]') = 'http://www.tableau.com'`

## Google BigQuery Specific Functions

### DOMAIN(string\_url)

Given a URL string, returns the domain as a string.

Example

`DOMAIN('http://www.google.com:80/index.html') = 'google.com'`

### GROUP\_CONCAT(expression)

Concatenates values from each record into a single comma-delimited string. This function acts like a SUM() for strings.

Example

`GROUP_CONCAT(Region) = "Central,East,West"`

### HOST(string\_url)

Given a URL string, returns the host name as a string.

Example

`HOST('http://www.google.com:80/index.html') = 'www.google.com:80'`

### LOG2(number)

Returns the logarithm base 2 of a number.

Example

`LOG2(16) = '4.00'`

### LTRIM\_THIS(string, string)

Returns the first string with any leading occurrence of the second string removed.

Example

`LTRIM_THIS('[-Sales-]','[-') = 'Sales-]'`

### RTRIM\_THIS(string, string)

Returns the first string with any trailing occurrence of the second string removed.

Example

`RTRIM_THIS('[-Market-]','-]') = '[-Market'`

### TIMESTAMP\_TO\_USEC(expression)

Converts a TIMESTAMP data type to a UNIX timestamp in microseconds.

Example

`TIMESTAMP_TO_USEC(#2012-10-01 01:02:03#)=1349053323000000`

### USEC\_TO\_TIMESTAMP(expression)

Converts a UNIX timestamp in microsseconds to a TIMESTAMP data type.

Example

`USEC_TO_TIMESTAMP(1349053323000000) = #2012-10-01 01:02:03#`

### TLD(string\_url)

Given a URL string, returns the top level domain plus any country domain in the URL.

Example

`TLD('http://www.google.com:80/index.html') = '.com'`

`TLD('http://www.google.co.uk:80/index.html') = '.co.uk'`

  
  

## Want to learn more about functions?

Read the [functions topics](https://help.tableau.com/current/public/desktop/en-us/functions.htm).

## See also

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