Friday, June 16, 2023

String Function In Tableau with example

 Certainly! Here is an explanation of various string functions in Tableau with examples:


1.LEN: Description: Returns the length (number of characters) of a string.

Example: LEN([Field])


2.UPPER: Description: Converts a string to uppercase.

Example: UPPER([Field])


3.LOWER: Description: Converts a string to lowercase.

Example: LOWER([Field])


4.TRIM: Description: Removes leading and trailing spaces from a string.

Example: TRIM([Field])


5.LEFT: Description: Returns a specified number of characters from the left side of a string.

Example: LEFT([Field], 5)


6.RIGHT: Description: Returns a specified number of characters from the right side of a string.

Example: RIGHT([Field], 3)


7.MID: Description: Returns a specified number of characters from a string, starting at a specified position.

Example: MID([Field], 2, 4)


8.FIND: Description: Returns the position of a substring within a string.

Example: FIND("abc", [Field])


9.REPLACE: Description: Replaces occurrences of a substring within a string with another substring.

Example: REPLACE([Field], "old", "new")


10.CONCAT: Description: Concatenates two or more strings into a single string.

Example: CONCAT([Field1], " - ", [Field2])


11.STR: Description: Converts a numeric value to a string.

Example: STR([Value])


12.LEFTSTR: Description: Returns a specified number of characters from the left side of a string, starting at the beginning.

Example: LEFTSTR([Field], 3)


13.RIGHTSTR: Description: Returns a specified number of characters from the right side of a string, starting at the end.

Example: RIGHTSTR([Field], 2)


14.SPLIT: Description: Splits a string into an array of substrings based on a delimiter.

Example: SPLIT([Field], ",")


15.JOIN: Description: Joins an array of strings into a single string, using a specified delimiter.

Example: JOIN([Array Field], ",")


16.REGEXP_REPLACE: Description: Replaces occurrences of a regular expression pattern within a string with another substring.

Example: REGEXP_REPLACE([Field], "\d+", "number")


These are just a few examples of string functions available in Tableau. Each function serves a specific purpose and can be used to manipulate, analyze, or format string values in your data. The choice of function depends on the specific string-related operations you need to perform.


No comments:

Post a Comment

If you have any doubts. Please let me know

How can you create an alias for a table in a SQL query?

In SQL, you can create an alias for a table in a query to give the table a temporary, alternative name that you can use in the query. Table ...