/    /  Amazon QuickSight – Ltrim

Amazon QuickSight – Ltrim

 

The ltrim() function in Amazon QuickSight is used to remove leading spaces from a string expression. This function returns a new string that has all the leading spaces removed.

 

Syntax

#Start#
ltrim(expression)
#End#

 

This function takes one argument:

 

  • expression: This is the string expression from which the leading spaces or characters are to be removed.

 

 

Suppose we have a dataset that contains information about employees’ names and their departments. We can use the ltrim() function in Amazon QuickSight to remove any leading spaces from the department names.

To remove leading spaces from the department names, we can create a new calculated field in Amazon QuickSight with the following expression:

 

Example

#Start#
ltrim(department)
#End#

 

This expression will remove any leading spaces from the department column in our dataset.

For instance, if our department data is as follows:

NameDepartment
John DoeHR
Jane SmithMarketing
Bob JohnsonOperations
Sally LeeFinance
Jim BrownHR

Then, the department data with leading spaces removed will be:

 

NameDepartmentDepartment (ltrim)
John DoeHRHR
Jane SmithMarketingMarketing
Bob JohnsonOperationsOperations
Sally LeeFinanceFinance
Jim BrownHRHR

 

In this example, we can see that the ltrim() function has removed the leading spaces from the department names, resulting in a cleaner and more consistent dataset.