Introduction:
Tableau invokes multiple mathematical functions for data analysis and Visualization. Similar to other programming languages or analysis tools, Tableau have several mathematical calculation including number, string, logical, aggregate functions, etc..
These functions help in visualizing the data more appropriately. The function included in tableau are as follows:
1) Aggregation Function
2) Number Function
3) Date Function
4) String Function
5) Logical Function
Aggregation Functions
Aggregation is applied to a measure by default in Tableau. Tableau queries the data source when you drag a measure into the display, and the data source returns the aggregated results. This improves Tableau's efficiency and clarifies your findings.
An aggregate function is one that combines the data from several lines into a single summative value. Tableau provides a range of integrated functions that facilitate the calculation of aggregations, including total, average, minimum, amount, and so on.
a) SUM
The Tableau Sum function is used to calculate the sum of data inside the selected measure.
SUM(Measure)
Eg: SUM([Sales])
b) AVG
The Tableau AVG function is used to calculate the average of data inside the selected measure.
AVG(Measure)
Eg: AVG([Sales])
c) MIN
MIN function in tableau is used to find the minimum value from the measure selected.
MIN(Measure)
Eg: MIN([Sales])
d) MAX
MAX function in tableau is used to find the maximum value from the measure selected.
MAX(Measure)
Eg: MAX([Sales])
e) STDDEV
The STDEV function in tableau calculates the statistical standard deviation of all values in a given measure using a population sample.
STDDEV(Measure)
Eg: STDDEV([Sales])
f) STDDEVP
The STDEVP function in tableau calculates the statistical standard deviation of all values in the provided measure using a biased population.
STDDEVP(Measure)
Eg: STDDEVP([Sales])
g) PERCENTILE
The Percentile function in tableau returns the percentile value of the provided measure according to the specified integer.
PERCENTILE (Measure, number)
Common percentiles used are 25th, 50th, 75th, and 100th percentile.
h) MEDIAN
The MEDIAN function in tableau is used to calculate the median of a measure across the identified data. Median is also called as 50th percentile as half of observation are above and half observation below in the given measure.
MEDIAN(Measure)
Eg: MEDIAN([SALES])
i) COUNT
COUNT function in tableau is used to return the number of items in the given measure, where null values are not excluded.
COUNT(Measure)
Eg: COUNT([SALES])
j) COUNTD
COUNTD function in tableau is used to return the unique number of items from the given measure.
COUNTD(Measure)
Eg: COUNTD([SALES])
k) VAR
VAR is used to calculate the statistical variances of all values in each expression using a population sample.
VAR (Measure)
Eg: VAR([Sales])
l) VARP
The VARP function is used to calculate the statistical variance of all values in each expression over the whole population.
VARP (Measure)
Eg: VARP([Sales])
m) ATTR
ATTR function in tableau is used to return the measures value if it contains single value for all rows.
ATTR (Measure)
Eg: ATTR([Sales])
CORR
The CORR function in tableau is used to calculate the Pearson Correlation coefficient for two non- aggregated variables.
CORR (Measure1, Measure2)
Eg: CORR([Profit], [Sales])
NUMBER FUNCTIONS
Number functions are used to perform computations on the data values in calculated fields. Number functions can only be used with fields that contain numerical values.
a) COS
The COS function in tableau is used to calculate the COSINE value for the given angle. The result obtained is in form of radius.
COS (Angle Value)
Eg: COS (PI ()/4=0.707)
b) SIN
The SIN function in tableau is used to calculate sine of the angle specified in form of radians.
SIN (Angle Value)
Eg: SIN (PI ()/4=0.708)
c) COT
The COT function in tableau is used to calculate cotangent of the angle specified in form of radians.
COT (Angle Value)
Eg: COT (PI ()/4=1)
d) DEGREES
The DEGREES function in tableau is used to calculate the value of Radians in form of DEGREES.
DEGRESS (Radian Value)
Eg: DEGRESS (PI ()/4= 45)
e) DIV
The DIV function in tableau is used to find the integer part of the result obtained from the division operation.
DIV (FIRST INTEGER, SECOND INTEGER)
Eg: DIV (20,4) =5
f) EXP
The EXP function in tableau is used to calculate the exponential value of the given number.
EXP(NUMBER)
Eg: EXP (2) = 7.389
g) FLOOR
The FLOOR function in tableau is used to round a number to the nearest integer value.
FLOOR(NUMBER)
Eg: FLOOR (2.234) = 2
h) SQUARE
The SQUARE function in tableau is used to calculate the square of the given number.
SQUARE(NUMBER)
Eg: SQUARE (9) = 81
i) ZN
The ZN function in tableau is used for returning the expression if it is not null. Otherwise, it will return the value as zero. The main purpose of this function is to replace the null values by zero.
ZN(Measure)
Eg: ZN(SUM([Sales]) = 23,95,894.
j) ABS
The ABS function in tableau is used to calculate the absolute value of the given number.
ABS(Number)
Eg: ABS (-10) = 10
k) CEILING
The CEILING function in tableau are used to round off floating or double values.
CEILING(Number)
Eg: CEILING(2.26)= 3