Tableau String Functions

Tableau Calculation string functions with Examples

Tableau has many inbuilt string functions, which allow you to manipulate string data. They are used to for comparing, concatenating and for replacing few characters from a string, etc.

Create Calculated Field

  1. In the Tableau Desktop, connect to the Excel file named Facebook Data which is saved in the data source.            tableau calculation string functions with examples 1
  2. Navigate to the worksheet pane and click on Analysis >Create Calculated Field as shown below.

tableau string functions with examples 2

  1. You will notice that a new dialogue box has appeared. Click on the icon present on the rightmost side of the box.

tableau string functions with examples 3

  1. You can see a tab linked with the previous one which lists all the functions that are available in Tableau.

tableau string functions with examples 4

  1. Further, you can change the dropdown value and choose only the functions that are related to Strings.

tableau string functions with examples 5

  1. On the rightmost side of the pane, you will notice that Tableau is briefing us with the formula and small explanation for the selected functions.

tableau string functions with examples 6

Create the Formula

For instance, if you want to find out the sales in the direction, which has occurred particularly in “west”. For this, we will use the CONTAINS string function and will create the formula as shown in the following screenshot. Also, change the name to Direction_west. And click on OK.

tableau string functions with examples 7

In the Data pane, under Measures, you will notice a field has been created named Direction_West.

tableau string functions with examples 8

Applying the Calculated Field

From the Data pane, under Dimensions, drag Month to the Rows shelf and from Measures drag Sales to the Columns shelf. It produces a bar chart showing the number of sales held for the different regions.

tableau string functions with examples 9

The above-calculated field can be applied in the view by dragging the Direction_West field to the Filters shelf. As soon as you drag it, a pop window will open as displayed in the following screenshot.

tableau string functions with examples 10

Select the ‘True’ option and click on OK. Tableau will create the bar charts for the sales that have occurred only in West direction. The following screenshot shows the Sales values.

 

tableau string functions with examples 11