/    /  Amazon QuickSight – Rtrim

Amazon QuickSight – Rtrim

 

The ‘rtrim’ function in Amazon QuickSight removes all trailing spaces from the right side of a string expression.

 

Syntax

#Start#
rtrim(expression)
#End#

 

This function takes one argument:

 

  • expression (required): the string expression to remove trailing spaces from.

 

Suppose you have a dataset containing a field with strings that have trailing spaces that you want to remove.

 

Assume the following dataset:

 

ItemDescription
AppleFresh apples
BananaRipe bananas
OrangeSweet oranges
PearJuicy pears
PeachDelicious peaches
MangoJuicy mangoes
KiwiTangy kiwis

 

To remove the trailing spaces from the Description field, you can use the rtrim function:

 

  • Select the dataset that you want to create a calculated field for.
  • Click on the “Add field” button.
  • Enter the following expression:

 

Example

#Start#
rtrim({Description})
#End#

 

This expression removes all trailing spaces from the Description field. The resulting calculated field will contain the trimmed strings.

 

  • Click “Create field” to create the calculated field.

 

After creating this calculated field, you can use the trimmed strings for visualizations and analysis. In this example, the calculated field would have the following values:

 

ItemDescriptionTrimmed Description
AppleFresh applesFresh apples
BananaRipe bananasRipe bananas
OrangeSweet orangesSweet oranges
PearJuicy pearsJuicy pears
PeachDelicious peachesDelicious peaches
MangoJuicy mangoesJuicy mangoes
KiwiTangy kiwisTangy kiwis

 

Note that the “Trimmed Description” column is a calculated field, and the values are not stored in the original dataset.