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!
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
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
Ceil is the function that rounds off to the next highest integer.
1 Like
Thanks @prantika_sinha . Hi @Ajinkya_Bangale - Please see whether you can use ceil function or not.
Regards - Sanjeeb
1 Like
@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?
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)
Hope this will help you.
Tagging @David_Wong @Biswajit_1993 @sagmukhe for their advise.
Regards - Sanjeeb
Thank you @prantika_sinha
This worked
1 Like
Wow… It is always good to see how community members helped together… Thank you @prantika_sinha @Ajinkya_Bangale
@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
I’m guessing it’s not the same metrics being feed to the site.