# Rounding to the next whole number (Not to the previous one)

**URL:** <https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627>\
**Category:** Q&A\
**Tags:** analysis, Business-Intelligence-Engineer, formatting, quick-sight\
**Created:** [September 24, 2023, 3:51am UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627 "2023-09-24T03:51:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ajinkya\_Bangale](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Ajinkya\_Bangale](https://community.amazonquick.com/u/Ajinkya_Bangale)\
**Post date:** [September 24, 2023, 3:51am UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627/1 "2023-09-24T03:51:49Z")

</div>

Hello Team,

My use case involves rounding the number to the next integer.  
I am calculating an average for a numeric value.

For instance, I want to display the following

13.02 should be displayed as 14  
13. 49 should be displayed as 14  
13.79 should be displayed a 14

For now, the decimal number gets rounded to the nearest integer.

13.02 → 13  
13.49 → 13  
13.79 → 14

Thank you!

---

<div class="post-metadata">

**Author:** ![Sanjeeb2022](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/sanjeeb2022/32/20947_2.png) [@Sanjeeb2022](https://community.amazonquick.com/u/Sanjeeb2022)\
**Post date:** [September 24, 2023, 4:16am UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627/2 "2023-09-24T04:16:26Z")

</div>

Hi @Ajinkya_Bangale - The round function is working as expected, if your decimal is \< 50 then it will round the previous integer or else it will round to next integer. If you really interested to round, then you may need to create a calculated field and extract the integer part before decimal and simply add 1.

Hope that way you can easily fix the issue.

Regards - Sanjeeb

---

<div class="post-metadata">

**Author:** ![Ajinkya\_Bangale](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Ajinkya\_Bangale](https://community.amazonquick.com/u/Ajinkya_Bangale)\
**Post date:** [September 24, 2023, 4:31am UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627/3 "2023-09-24T04:31:01Z")

</div>

Hello @Sanjeeb2022 ,

Thank you for the response.

Yes - the round function works perfectly fine. I wanted to know if there is a built in function in QS to do that?

The example I provided was simple. The average value I am getting already involves a lot of calculation.

Can you please provide the formula?

If I am getting an integer value X using a calculated field,  
I need to get the average of the integer and the decimal value should round up to the next integer.

Thank you

---

<div class="post-metadata">

**Author:** ![prantika\_sinha](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/prantika_sinha/32/21878_2.png) [@prantika\_sinha](https://community.amazonquick.com/u/prantika_sinha)\
**Post date:** [September 24, 2023, 11:00am UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627/4 "2023-09-24T11:00:13Z")

</div>

Ceil is the function that rounds off to the next highest integer.

---

<div class="post-metadata">

**Author:** ![Sanjeeb2022](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/sanjeeb2022/32/20947_2.png) [@Sanjeeb2022](https://community.amazonquick.com/u/Sanjeeb2022)\
**Post date:** [September 24, 2023, 11:56am UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627/5 "2023-09-24T11:56:40Z")

</div>

Thanks @prantika_sinha . Hi @Ajinkya_Bangale - Please see whether you can use ceil function or not.

Regards - Sanjeeb

---

<div class="post-metadata">

**Author:** ![Ian\_Boodram](https://avatars.discourse-cdn.com/v4/letter/i/b9bd4f/32.png) [@Ian\_Boodram](https://community.amazonquick.com/u/Ian_Boodram)\
**Post date:** [September 24, 2023, 1:14pm UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627/6 "2023-09-24T13:14:15Z")

</div>

@Sanjeeb2022 , I’m comparing numbers being rounded off and it’s inconsistent with the numbers from Station Dash board which shows a site, example 0.638 but when I check it on quicksight it shows 0.7.  
When compared to another site which shows 0.663 but on quicksight shows to be 0.6  
Is this a lag issue or is it not rounding off properly?

---

<div class="post-metadata">

**Author:** ![Sanjeeb2022](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/sanjeeb2022/32/20947_2.png) [@Sanjeeb2022](https://community.amazonquick.com/u/Sanjeeb2022)\
**Post date:** [September 24, 2023, 1:31pm UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627/7 "2023-09-24T13:31:35Z")

</div>

Hi @Ian_Boodram - Welcome to AWS Quick Sight community and thanks for posting the question.

We need to understand what is the scale we are putting while calculating the round.

I assume in your case the scale is 1.

See the below result  
when the scale is 1, and the number is 0.663, round function check the second decimal place which is 6 \>5 so it round to 0.7  
When the number is 0.631, the second decimal is 3 \<5 so it rounds to 6.

I tested it, the calculated field formula is `round({test_num},1)`

 ![image](https://d1wl4jav5dp96l.cloudfront.net/original/2X/3/395c820c87c8bd1808e635aea064091190323efd.png)

Hope this will help you.

Tagging @David_Wong @Biswajit_1993 @sagmukhe for their advise.

Regards - Sanjeeb

---

<div class="post-metadata">

**Author:** ![Ajinkya\_Bangale](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Ajinkya\_Bangale](https://community.amazonquick.com/u/Ajinkya_Bangale)\
**Post date:** [September 24, 2023, 1:39pm UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627/8 "2023-09-24T13:39:29Z")

</div>

Thank you @prantika_sinha

This worked

---

<div class="post-metadata">

**Author:** ![Sanjeeb2022](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/sanjeeb2022/32/20947_2.png) [@Sanjeeb2022](https://community.amazonquick.com/u/Sanjeeb2022)\
**Post date:** [September 24, 2023, 1:52pm UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627/9 "2023-09-24T13:52:39Z")

</div>

Wow… It is always good to see how community members helped together… Thank you @prantika_sinha @Ajinkya_Bangale

---

<div class="post-metadata">

**Author:** ![Ian\_Boodram](https://avatars.discourse-cdn.com/v4/letter/i/b9bd4f/32.png) [@Ian\_Boodram](https://community.amazonquick.com/u/Ian_Boodram)\
**Post date:** [September 24, 2023, 2:38pm UTC](https://community.amazonquick.com/t/rounding-to-the-next-whole-number-not-to-the-previous-one/18627/10 "2023-09-24T14:38:59Z")

</div>

@Sanjeeb2022 Thank you for confirmartion. I’m comparing it from a different site used for MLA metrics.  
[https://w.amazon.com/bin/view/DeliveryStationTech/ConveyorAutomation/Runbook/StationDashboards/NA](https://w.amazon.com/bin/view/DeliveryStationTech/ConveyorAutomation/Runbook/StationDashboards/NA)  
I’m guessing it’s not the same metrics being feed to the site.
