Tableau Tip #12 – MORE SECRETS FROM THE LOST TABLEAU MANUAL: FIVE MORE HIDDEN FUNCTIONS IN TABLEAU 

Here are 5 more hidden functions for you to use.

CURRENT_TIME() – Returns the current time, without the date part.

Example:
CURRENT_TIME() = 11:22:53 AM

ISNOTDISTINCT() – Checks if two expressions are not distinct from each other.

Examples:
ISNOTDISTINCT(NULL, “plane”) = False
ISNOTDISTINCT(13, 13) = True
ISNOTDISTINCT(“foo”, “bar”) = False

LIKE() – Checks if a string matches a certain pattern.

Example:
LIKE(“This workbook is great!”, “%workbook%gr_a%”) = True
LIKE(“Universe”, “U_i%”) = True
LIKE(“W-ORDER_01”, “W-ORDER\_%”) = True

TRUNC() – Chops off the decimal places from a number, according to the specified number of digits.

Example:
TRUNC(123.4, -2) = 100
TRUNC(9876.543, -1) = 9870
TRUNC(98.765) = 98

SIDE NOTE: I was asked by a co-worker what the difference was between TRUNC() and FLOOR(). I knew the best person to answer this question was Ken Flerlage. Sure enough, Ken provided me the answer below.

I’ve never used TRUNC but I suspected it would be different when dealing with negative numbers. So I just tested it and that is true. Take the number -253.57. Floor will round the number down to -254. TRUNC simply removes the decimals, resulting in -253. If your numbers are all positive, the results will always be the same. Note: In Tableau, INT will do the same thing as TRUNC so I’d use that function instead since it’s not a hidden function. If you need the field’s data type to be a float, then convert it back to a FLOAT after doing INT.

ISCURRENTUSER() – Checks if the current user is the specified user. Same as ISUSERNAME().

Example:
ISCURRENTUSER(“Yovel”) = True

This post was inspired by Yovel Deutel‘s viz on Hidden Functions. Here is the link to Yovel’s Tableau Workbook in Tableau Public.

Credit: Yovel Deutel

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.