Tableau – Functions: Numeric, String, Date, Logical & Aggregate

When we create any dashboard where we have to analyze the data, we need to perform multiple calculations. It is not necessary that the data source would have all the fields for the visualization. For creating numerous calculations, we need to use many inbuilt Tableau functions. In this article, we will discuss the categories of functions that are present in Tableau.

Here are categories of functions that we can use in Tableau to create complex calculations:

  1. Numeric Functions
  2. String Functions
  3. Date Functions
  4. Logical Functions 
  5. Aggregate Functions

Let’s discuss them more thoroughly to understand how each of the functions works.

Tableau Numeric Functions

Numeric Functions help in manipulating the numeric values. These functions are performed on numbers and return numbers. Let’s look at the important numeric functions present in Tableau.

  • CEILING (number) – This function rounds up the number to the nearest integer of the equal or the greater value.

For example :- CEILING(3.45) = 4

  • ROUND (number, [decimal] ) – This function rounds up the value to the nearest value or the specified number of the decimal places.

For example :- ROUND(3.16527 , 2) = 3.17

  • POWER (number, power) – This numeric function returns the result of a number raised to the given power.

For example :- POWER (2,4) = 16


Tableau String Functions

String Functions help in manipulating the string present in the data source. Let’s look at the important String functions present in Tableau.

  • LEN (string) – This function helps in returning the number of characters present in the given string.

For example :- LEN (“Tableau”) = 7

  • LTRIM (string) – This function removes any leading of the spaces present in the string.

For example :- LTRIM (”  Tableau”) = “Tableau”

  • REPLACE (string, substring, replacement) – This function returns a string in which every occurrence of the substring is replaced with the replacement string. If the string is not found then the string is unchanged.

For example :- REPLACE (“Replacing” , “ing” , “ed”) = “Replaced”

  • UPPER (string) – This function converts the string to all the Upper case letters.

For example :- UPPER (“upper” ) = “UPPER”


Tableau Date Functions

Tableau has many date functions that are often used and only involve dates. Use the date_part which is a string indicating the part of the date such as a month, day, and year. Let’s look at the important date functions present in Tableau.

  • DATEADD (date_part, increment, date) – This function adds the increment on the specified date and returns a new date. The increment is defined by interval and the date_part.

For example :- DATEADD(‘month’ , 2 , #2022-01-17#) = 2022-03-17 12:00:00 AM

  • DATENAME (date_part, date, [start_of_week]) – This function returns a part of the given date as a string where it is defined as date_part

For example :- DATENAME(‘month’ , #2022-01-17#) = “January”

  • DAY (date) – This function returns the day of the given date.

For example :- DAY (#2022-01-17#) = 17

  • NOW () – This function returns the current date and time.

For example :- NOW() = 2022-06-07  01:50:45 PM


Tableau Logical Functions

Tableau provides various Logical Functions to perform logical operations on our data. Logical functions are used to test whether a condition is true or false. Let’s look at the important Logical functions present in Tableau.

  • IFNULL (expression1, expression2) – This function returns the first expression if it is NOT NULL, otherwise returns the second expression.

For example :- IFNULL( [Sales] , 0)

  • ISDATE (string) – This function returns TRUE if a given string is a Valid date.

For example :- ISDATE(“2022-06-07”) = True

  • MIN(expression) – This function returns the minimum of an expression across all records or the minimum of the two expressions for each record.

For example :- MIN([Sales])


Tableau Aggregate Functions

Aggregate Functions are the type of function where values of multiple rows are grouped.  Many aggregate functions are present in Tableau. Let’s look at the important Aggregate functions present in Tableau.

  • SUM(expression) – This function returns the SUM of all the values in the expression. Null values are ignored. AVG IS used with numeric fields only
  • AVG(expression) – This function returns the AVERAGE of all the values in the expression. Null values are ignored.
  • COUNT(expression) – This function returns the number of items in a field. Null values are ignored.
  • STDEV (expression) – This function returns the statistical standard deviation of all values in the given expression based on a sample of the population.

Check out other useful Tableau charts below:

Follow us on Twitter, Facebook, Linkedin, and Tableau Public to stay updated with our latest blog and what’s new in Tableau.