TEXT OPERATORS
Calculated fields are not constrained to numerical calculations. Several text operators can be applied to text fields formatted as strings.
Splits
Often, a single text field contains several pieces of information. For example, the name Lisa Smith could be split into a first name and a last name. You saw in Chapter 2 how to split fields in the data source editor. This feature uses the SPLIT
operator, which you can also use manually in a calculated field.
Let's consider the Product Name
field in the Superstore dataset. Most of the entries contain the manufacturer name as the first word in the string: e.g. Apple in Apple iPhone 5. You can create a calculated field called Manufacturer
to extract that information. To do so, use the following formula (see also Figure 4.5):
SPLIT([Product Name], " ", 1)

Figure 4.5 Calculation to split off the first word of a string.
Here, you are asking Tableau to split the string Product Name
at the spaces (as specified by...