all functions in Tableau (1)
all functions in Tableau (1)
1. Numeric Functions:
ABS: Returns the absolute value of a number.
Syntax: ABS(number)
Example: ABS(-5) returns 5
2. ROUND: Rounds a number to a specified number of decimal places.
Syntax: ROUND(number, num_digits)
Example: ROUND(3.14159, 2) returns 3.14
3. String Functions:
a. LEFT: Returns the leftmost characters from a string.
Syntax: LEFT(string, length)
Example: LEFT("Tableau", 3) returns "Tab"
b. UPPER: Converts a string to uppercase.
Syntax: UPPER(string)
Example: UPPER("tableau") returns "TABLEAU"
4. Date Functions:
a. YEAR: Extracts the year from a date.
Syntax: YEAR(date)
Example: YEAR(#2023-05-06#) returns 2023
b. DATEDIFF: Returns the difference between two dates.
Syntax: DATEDIFF(date_part, start_date, end_date)
Example: DATEDIFF('day', #2023-01-01#, #2023-01-10#) returns 9
5. Logical Functions:
a. IF: Returns one value if a condition is true and another if it's false.
Syntax: IF(condition, value_if_true, value_if_false)
Example: IF([Sales] > 1000, "High", "Low") returns "High" if sales are
over 1000, otherwise "Low"
b. AND: Returns true if all arguments are true.
Syntax: AND(expression1, expression2, ...)
Example: AND([Sales] > 1000, [Profit] > 500) returns TRUE if both
conditions are met
6. Aggregate Functions:
a. SUM: Returns the sum of values in a field.
Syntax: SUM(expression)
Example: SUM([Sales]) returns the total sales amount.
b. AVG: Returns the average of values in a field.
Syntax: AVG(expression)
Example: AVG([Profit]) returns the average profit.
c. MIN: Returns the minimum value in a field.
Syntax: MIN(expression)
d. MAX: Returns the maximum value in a field.
Syntax: MAX(expression)
e. COUNT: Returns the number of rows in a field.
Syntax: COUNT(expression)
7. Logical Functions:
a. IF: Returns one value if a condition is true and another if it's false.
Syntax: IF(condition, value_if_true, value_if_false)
b. AND: Returns true if all arguments are true.
Syntax: AND(expression1, expression2, ...)
c. OR: Returns true if any argument is true.
Syntax: OR(expression1, expression2, ...)
d. NOT: Returns the logical opposite of an expression.
Syntax: NOT(expression)
8. Date Functions:
a. DATEPART: Returns a component of a date.
Syntax: DATEPART(date_part, date)
b. DATETRUNC: Truncates a date to a specified level of precision.
Syntax: DATETRUNC(date_part, date)
c. DATEDIFF: Returns the difference between two dates.
Syntax: DATEDIFF(date_part, start_date, end_date)
d. DATEADD: Adds a specified interval to a date.
Syntax: DATEADD(date_part, interval, date)
9. String Functions:
a. LEN: Returns the length of a string.
Syntax: LEN(string)
b. UPPER: Converts a string to uppercase.
Syntax: UPPER(string)
c. LOWER: Converts a string to lowercase.
Syntax: LOWER(string)
d. TRIM: Removes leading and trailing spaces from a string.
Syntax: TRIM(string)
10. Numeric Functions:
a. ABS: Returns the absolute value of a number.
Syntax: ABS(number)
b. ROUND: Rounds a number to a specified number of decimal places.
Syntax: ROUND(number, num_digits)
c. INT: Returns the integer portion of a number.
Syntax: INT(number)
11. Table Calculation Functions:
a. WINDOW_SUM: Computes the sum of a field across a specified window of
records.
Syntax: WINDOW_SUM(expression)
b. WINDOW_AVG: Computes the average of a field across a specified window
of records.
Syntax: WINDOW_AVG(expression)
c. RUNNING_SUM: Computes the running sum of a field.
Syntax: RUNNING_SUM(expression)
d. PREVIOUS_VALUE: Returns the value of an expression from the previous
row.
Syntax: PREVIOUS_VALUE(expression)
12. Table Calculation Control Functions:
a. WINDOW_MAX: Returns the maximum value over a sliding window.
Syntax: WINDOW_MAX(expression)
b. WINDOW_MIN: Returns the minimum value over a sliding window.
Syntax: WINDOW_MIN(expression)
c. WINDOW_AVG: Returns the average value over a sliding window.
Syntax: WINDOW_AVG(expression)
d. WINDOW_STDEV: Returns the standard deviation over a sliding window.
Syntax: WINDOW_STDEV(expression)
13. Table Calculation Addressing Functions:
a. LOOKUP: Returns the value of an expression from a specific row or column.
Syntax: LOOKUP(expression, offset)
b. ATTR: Returns the value of the specified expression if there is only one value.
Syntax: ATTR(expression)
c. INDEX: Returns the index of the current row within the partition.
Syntax: INDEX()
d. FIRST() / LAST(): Returns the value of the expression for the first/last row in
the partition.
Syntax: FIRST() / LAST()
14. Type Conversion Functions:
a. STR: Converts a number to a string.
Syntax: STR(number)
b. FLOAT: Converts a string to a floating-point number.
Syntax: FLOAT(string)
c. INT: Converts a string to an integer.
Syntax: INT(string)
15. Math Functions:
a. SQRT: Returns the square root of a number.
Syntax: SQRT(number)
b. POWER: Raises a number to a specified power.
Syntax: POWER(number, power)
c. LOG: Returns the natural logarithm of a number.
Syntax: LOG(number)
d. EXP: Returns e raised to the power of a number.
Syntax: EXP(number)
16. Set Functions:
a. ISMEMBEROF: Returns true if a member belongs to a specified set.
Syntax: ISMEMBEROF(set, member)
b. ISNULL: Returns true if the expression is null.
Syntax: ISNULL(expression)
c. ISDATE: Returns true if the expression is a valid date.
Syntax: ISDATE(expression)
17. Geospatial Functions:
a. DISTANCE: Calculates the distance between two points.
Syntax: DISTANCE(lat1, lon1, lat2, lon2, unit)
b. MAKELINE: Creates a line geometry from a set of points.
Syntax: MAKELINE(latitude, longitude)
c. WITHIN: Returns true if a point is within a specified region.
Syntax: WITHIN(latitude, longitude, region)
18. Forecasting Functions:
a. FINDNTH: Finds the nth occurrence of a value in a field.
Syntax: FINDNTH(field, value, n)
b. ZN: Replaces null values with zero.
Syntax: ZN(expression)
c. WINDOW_AVG: Computes the average of a field across a specified window
of records.
Syntax: WINDOW_AVG(expression)
19. Database Functions:
a. DATABASE: Returns the name of the current database.
Syntax: DATABASE()
b. USERNAME: Returns the name of the current user.
Syntax: USERNAME()
c. TABLENAME: Returns the name of the current table.
Syntax: TABLENAME()
20. These functions provide additional capabilities for data analysis, manipulation, and
integration within Tableau.
21. WINDOWMAX: Returns the maximum value of a window function.
Syntax: WINDOWMAX(expression)
22. WINDOWMIN: Returns the minimum value of a window function.
Syntax: WINDOWMIN(expression)
23. Map Functions:
a. ZOOM: Changes the zoom level of a map.
Syntax: ZOOM(level)
b. PAN: Changes the center point of a map.
Syntax: PAN(latitude, longitude)
24. Statistical Functions:
a. CORR: Computes the correlation coefficient between two fields.
Syntax: CORR(field1, field2)
b. STDEV: Returns the standard deviation of a field.
Syntax: STDEV(expression)
25. Table Calculation Addressing Functions:
a. RUNNING_SUM: Computes the running sum of a field.
Syntax: RUNNING_SUM(expression)
b. RUNNING_AVG: Computes the running average of a field.
Syntax: RUNNING_AVG(expression)