/    /  Amazon QuickSight – parseInt

Amazon QuickSight – parseInt

 

The ‘parseInt’ function in Amazon QuickSight converts a string to an integer number. The parseInt function determines whether a string contains an integer value. By default, this function returns all rows with decimal, integer, or null values, and skips empty rows. Rows with decimal values are rounded down to the nearest integer. 

Syntax

 

#Start#
parseInt(expression)
#End#

 

This function takes one argument:

 

  • expression (required): the expression to convert to an integer number.

 

 

Suppose you have a dataset containing numeric values in string format, such as ’10’ or ‘100’. However, QuickSight does not recognize these strings as integers, so you need to convert them using the parseInt function.

 

Assume the following dataset:

 

ItemQuantity
Apple10
Banana5
Orange7
Pear$12

 

To convert the Quantity field to an integer number, you can use the parseInt 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#
parseInt({Quantity})
#End#

 

This expression converts the Quantity field to an integer number. The resulting calculated field will be an integer number that QuickSight can recognize and use for visualizations and analysis.

 

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

 

After creating this calculated field, the Quantity field will be recognized as an integer number, and you can use it for visualizations and analysis. In this example, the calculated field would have the following values:

 

ItemQuantity
Apple10
Banana5
Orange7
Pear12

 

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