Site icon i2tutorials

Amazon QuickSight – Split

Amazon QuickSight – Split

 

The ‘split’ function in Amazon QuickSight splits a string expression into an array of substrings based on a specified delimiter and returns the substring at the specified position in the array.

 

Syntax

 

#Start#
split(expression, delimiter, position)
#End#

 

This function takes three arguments:

 

 

 

Suppose you have a dataset containing a field with full names that you want to split into first and last names.

 

Assume the following dataset:

ItemProperties
AppleRed, Sweet, Crisp
BananaYellow, Sweet
OrangeOrange, Juicy
PearGreen, Juicy
PeachFuzzy, Sweet
MangoYellow, Sweet
KiwiBrown, Tart

 

To split the Properties field into separate fields for each property, you can use the split function:

 

 

Example

#Start#
split({Properties}, ', ', 1)
split({Properties}, ', ', 2)
split({Properties}, ', ', 3)
#End#

 

These expressions split the Properties field into three separate fields. The first expression returns the first property, the second expression returns the second property, and the third expression returns the third property.

 

 

After creating these calculated fields, you can use them for visualizations and analysis. In this example, the calculated fields would have the following values:

 

ItemPropertiesProperty 1Property 2Property 3
AppleRed, Sweet, CrispRedSweetCrisp
BananaYellow, SweetYellowSweet(null)
OrangeOrange, JuicyOrangeJuicy(null)
PearGreen, JuicyGreenJuicy(null)
PeachFuzzy, SweetFuzzySweet(null)
MangoYellow, SweetYellowSweet(null)
KiwiBrown, TartBrownTart(null)

 

Note that the “Property 1”, “Property 2”, and “Property 3” columns are calculated fields, and the values are not stored in the original dataset.

 

Exit mobile version