endsWith - Amazon QuickSight

Important: We've redesigned the Amazon QuickSight analysis workspace. You might encounter screenshots or procedural text that doesn't reflect the new look in the QuickSight console. We're in the process of updating screenshots and procedural text.

To find a feature or item, use the Quick search bar.

For more information on QuickSight's new look, see Introducing new analysis experience on Amazon QuickSight.

endsWith

endsWith evaluates if the expression ends with a substring that you specify. If the expression ends with the substring, endsWith returns true, and otherwise it returns false.

Syntax

endsWith(expression, substring, string-comparison-mode)

Arguments

expression

The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string.

substring

The set of characters to check against the expression. The substring can occur one or more times in the expression.

string-comparison-mode

(Optional) Specifies the string comparison mode to use:

  • CASE_SENSITIVE – String comparisons are case-sensitive.

  • CASE_INSENSITIVE – String comparisons are case-insensitive.

This value defaults to CASE_SENSITIVE when blank.

Return type

Boolean

Examples

Default case sensitive example

The following case sensitive example evaluates if state_nm endsWith "York".

endsWith(state_nm, "York")

The following are the given field values.

New York new york

For these field values, the following values are returned.

true false

Case insensitive example

The following case insensitive example evaluates if state_nm endsWith "york".

endsWith(state_nm, "york", CASE_INSENSITIVE)

The following are the given field values.

New York new york

For these field values, the following values are returned.

true true

Example with conditional statements

The endsWith function can be used as the conditional statement within the following If functions: avgIf, minIf, distinct_countIf, countIf, maxIf, medianIf, stdevIf, stdevpIf, sumIf, varIf, and varpIf.

The following example sums Sales only if state_nm ends with "York".

sumIf(Sales,endsWith(state_nm, "York"))

Does NOT contain example

The conditional NOT operator can be used to evaluate if the expression does not start with the specified substring.

NOT(endsWith(state_nm, "York"))

Example using numeric values

Numeric values can be used in the expression or substring arguments by applying the toString function.

endsWith(state_nm, toString(5) )