Amazon QuickSight – Round
The round function in Amazon QuickSight rounds a decimal number to a specified number of decimal places.
Syntax
#Start# round(decimal, scale) #End#
This function takes two arguments:
- decimal (required): the decimal number to round.
- scale (required): the number of decimal places to round to.
Suppose you have a dataset containing a field with decimal numbers that you want to round to 2 decimal places.
Assume the following dataset:
| Item | Price |
| Apple | 1.2345 |
| Banana | 2.3456 |
| Orange | 3.4567 |
| Pear | 4.5678 |
To round the Price field to 2 decimal places, you can use the round 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# round({Price}, 2) #End#
This expression rounds the Price field to 2 decimal places. The resulting calculated field will contain the rounded decimal values.
- Click “Create field” to create the calculated field.
After creating this calculated field, you can use the rounded decimal values for visualizations and analysis. In this example, the calculated field would have the following values:
| Item | Price | Rounded Price |
| Apple | 1.2345 | 1.23 |
| Banana | 2.3456 | 2.35 |
| Orange | 3.4567 | 3.46 |
| Pear | 4.5678 | 4.57 |
Note that the “Rounded Price” column is a calculated field, and the values are not stored in the original dataset. The round function uses the half-up rounding method, which rounds numbers up if the next digit is 5 or greater, and rounds down otherwise.