0% found this document useful (0 votes)
75 views

Primary Functions: Tableau Desktop Reference Guide

The document summarizes the primary functions in Tableau that perform calculations on aggregated table data. It describes functions like TOTAL, LOOKUP, PREVIOUS_VALUE, and RUNNING_SUM that return values based on the current scope and direction. It also describes WINDOW functions like WINDOW_AVG, WINDOW_SUM, and WINDOW_CORR that calculate averages, sums, and correlations within a specified window. Finally, it mentions RANK functions that calculate standard competition ranks and how identical values are handled.

Uploaded by

Karthigai Selvan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Primary Functions: Tableau Desktop Reference Guide

The document summarizes the primary functions in Tableau that perform calculations on aggregated table data. It describes functions like TOTAL, LOOKUP, PREVIOUS_VALUE, and RUNNING_SUM that return values based on the current scope and direction. It also describes WINDOW functions like WINDOW_AVG, WINDOW_SUM, and WINDOW_CORR that calculate averages, sums, and correlations within a specified window. Finally, it mentions RANK functions that calculate standard competition ranks and how identical values are handled.

Uploaded by

Karthigai Selvan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Tableau eLearning

Primary Functions
Tableau Desktop Reference Guide
The primary functions perform computations on the table.

Note that since the calculations are computed on the aggregated table data, field arguments for these functions must be aggregated as well, for example
SUM([Profit]).

Function Syntax Purpose Example


TOTAL (expression) Returns the total for the given expression in the TOTAL(SUM([Sales])) returns the total for the sum
current partition. of sales based on the current scope and direction.
LOOKUP (expression,[offset]) Returns the value of the expression in a target LOOKUP(SUM([Profit]), FIRST()+2) computes the
row, specified as a relative offset from the current SUM([Profit]) in the third row of the partition.
row.
If the offset is -1, then the result will be returned
for the previous value in the scope and direction.
PREVIOUS_VALUE Returns the value of the expression in the SUM([Profit]) + PREVIOUS_VALUE(1) computes
(expression) previous row. the running total of SUM([Profit]).
RUNNING_SUM Returns the running sum of the given expression, RUNNING_SUM(SUM([Profit]))
(expression) from the first row in the partition to the current computes the running sum of SUM([Profit])
RUNNING_AVG, row.
RUNNING_MAX,
RUNNING_MIN, and
RUNNING_COUNT
are similar
WINDOW_AVG(expression, Returns the average of the expression within the WINDOW_AVG(SUM([Profit]),
[start, end]) window. FIRST()+1, 0) computes the average of
WINDOW_SUM, WINDOW_MAX, WINDOW_MIN, If the optional start and end are omitted, the SUM([Profit]) from the second row to the current
WINDOW_MEDIAN, entire partition is used. row.l
WINDOW_COUNT,
WINDOW_PERCENTILE,
WINDOW_STDEV,
WINDOW_STDEVP,
WINDOW_VAR,
WINDOW_VARP
are all similar
1 of 2
TABLEAU.COM/ELEARNING
Function Syntax Purpose Example
WINDOW_CORR Returns the Pearson correlation coefficient of WINDOW_CORR(SUM([Sales]), SUM([Profit]))
(expression1, expression2, [start, end]) the two expressions within the window. If the returns a value from - 1 to 1. The result is equal
optional start and end are omitted, the entire to 1 for an exact positive linear relationship, 0 for
partition is used. no linear relationship, and -1 for an exact negative
linear relationship.
WINDOW_COVAR WINDOW_COVARP is similar, but for a WINDOW_COVAR(SUM([Sales]),
(expression1, expression2, [start, end]) population, instead of a sample. Returns the SUM([Profit])) returns a positive number if the
sample covariance of two expressions within the expressions tend to vary together, on average.
window. If the optional start and end are omitted,
the entire partition is used. If the two expressions
are the same, a value is returned that indicates
how widely the variables are distributed.
RANK (expression, [order]) Returns the standard competition rank for the RANK(AVG([Test Score]))
RANK_DENSE, RANK_. MODIFIED, RANK_ current row in the partition.
UNIQUE, RANK_, PERCENTILE

In the WINDOW functions, the window is defined by means of offsets from the current row. Use the helper functions 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.

To calculate a population and sample standard deviation and variance, use the WINDOW_STDEV,

WINDOW_STDEVP, WINDOW_VAR, and WINDOW_VARP functions.

To calculate the measure or extent of joint variability of two expressions within a window, use the WINDOW_CORR, WINDOW_COVAR, and WINDOW_
COVARP functions.

In the RANK functions you can optionally use ‘asc’ or ‘desc’ to specify the ranking order. The default is descending.

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.

The RANK functions vary on how they process identical values, such as when the ranks for the set of values (6, 9, 9, 14) are computed:

• R ANK: Identical values are assigned an identical rank, for example 1, 2, 2, 4.


• R ANK_DENSE: Identical values are assigned an identical rank, but no gaps are inserted into the number sequence, for example 1, 2, 2, 3.

Script Table Calculation Functions


Additional functions are available to interact directly with external service scripts, including those in R, MATLAB, and Python. The SCRIPT functions vary in
the data type returned, Boolean, string, integer, or real number: SCRIPT_BOOL, SCRIPT_STR, SCRIPT_INT, and SCRIPT_REAL.

2 of 2
TABLEAU.COM/ELEARNING

You might also like