Amazon QuickSight – parseDecimal
The parseDecimal function in Amazon QuickSight converts a string to a decimal number.
Syntax
#Start# parseDecimal(expression) #End#
This function takes one argument:
- Expression (required): the expression to convert to a decimal number.
Suppose you have a dataset containing prices in string format, such as ‘10.99’ or ‘$5.00’. However, QuickSight does not recognize these strings as decimal numbers, so you need to convert them using the parseDecimal function.
Assume the following dataset:
| Item | Price |
| Apple | 0.99 |
| Banana | $1.25 |
| Orange | $0.89 |
| Pear | 1.50 |
To convert the Price field to a decimal number, you can use the parseDecimal 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# parseDecimal({Price}) #End#
This expression converts the Price field to a decimal number. The resulting calculated field will be a decimal 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 Price field will be recognized as a decimal number, and you can use it for visualizations and analysis. In this example, the calculated field would have the following values:
| Item | Price |
| Apple | 0.99 |
| Banana | 1.25 |
| Orange | 0.89 |
| Pear | 1.50 |
Note that the “Price” column is a calculated field, and the values are not stored in the original dataset.