Other functions

Beyond the functions discussed so far, there are some other important functions that are useful and available in Tableau. One of those is the type conversion functions. Type conversion functions are useful for converting one data type into another, for example, from an integer into a string or from a float into an integer.

All of the following functions follow the common syntax of Function(expression):

DATE

It is used to obtain a date from numbers or strings or date expressions, for example, DATE("25/05/2019") returns #25-05-2019#.

DATETIME

Very similar to DATE, this function returns the date and time, for example, DATETIME("25 May 2019 13:40:00") returns #25-05-2019 13:40:00#.

FLOAT

This is used to cast to floating-point numbers, for example, FLOAT(2)=2.000.

INT

This is used to cast its argument to integers, for example INT("22")=22 or INT(22.2)=22.

STR

This is used to cast values to a string, for example, STR(22) results in a string, 22.

 

For example, if there is number field 12 and another number field, 22, and we want to obtain the concatenated field 1222, we can convert them into strings and back into numbers as INT( (STR(12)+STR(22)) and it will return 1222 as a number. Type conversions can help many times when we need to create complex calculations and need the output of one field to be in the correct format to be the input of another.

User functions are another set of useful Tableau functions. These are useful to create row-level filters and security to limit the fields that are visible if your dashboard is published to Tableau Online or Server. Tableau also allows for some regular expression functionalities in functions such as REGEXP_MATCH or REGEXP_EXTRACT, which can be used to create some advanced string matching. Also, in the next chapter, we will study some advanced table calculation functions that haven't been discussed so far.

One last thing we will discuss in this chapter will be totals and subtotals and how they can be used.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.151.126