Site icon i2tutorials

Amazon QuickSight – startsWith

Amazon QuickSight – startsWith

 

The ‘startsWith’ function in Amazon QuickSight is used to determine whether a string expression starts with a specified substring. It returns a Boolean value of true or false depending on whether the substring is found at the beginning of the expression.

 

Syntax

 

#Start#
startsWith(expression, substring, string-comparison-mode)
#End#

 

This function takes three arguments:

 

 

 

Suppose you have a dataset containing a field with product names, and you want to filter the dataset to show only products that start with the word “Amazon”.

 

Assume the following dataset:

 

Product NamePrice
Amazon Echo Dot$49
Google Nest Mini$39
Amazon Fire TV Stick$39
Apple HomePod Mini$99
Amazon Kindle$89
Amazon Basics Mouse$10

 

To create a filter that only shows products that start with the word “Amazon”, you can use the startsWith function:

 

Example

 

#Start#
startsWith({Product Name}, "Amazon")
#End#

 

This expression returns true for any product name that starts with the word “Amazon” and false for any product name that does not.

 

 

After applying the filter, the dataset would show only the following rows:

 

Product NamePrice
Amazon Echo Dot$49
Amazon Fire TV Stick$39
Amazon Kindle$89
Amazon Basics Mouse$10

 

Note that the filter is case-sensitive by default, so it only matches product names that start with the exact sequence of characters “Amazon”. If you want to do a case-insensitive match, you can set the string-comparison-mode parameter to “ignore case”, like this:

 

Example

 

#Start#
startsWith({Product Name}, "amazon", "ignore case")
#End#

 

Exit mobile version