# What to do with incorrect calculated field?

**URL:** <https://community.amazonquick.com/t/what-to-do-with-incorrect-calculated-field/3406>\
**Category:** Q&A\
**Tags:** error, calculations, quick-sight\
**Created:** [May 4, 2022, 4:36am UTC](https://community.amazonquick.com/t/what-to-do-with-incorrect-calculated-field/3406 "2022-05-04T04:36:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amber](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@amber](https://community.amazonquick.com/u/amber)\
**Post date:** [May 4, 2022, 4:36am UTC](https://community.amazonquick.com/t/what-to-do-with-incorrect-calculated-field/3406/1 "2022-05-04T04:36:14Z")

</div>

I have a calculated field which looks something like this:

1.0 \* value\_today - value\_tomorrow \* 1.0

value\_today = 0.00000000051231231  
value\_tomorrow = 0.00000000051231231

But my result is -0.9999999999999999

How can i make my result = 0 instead?

 ![quicksight_error](https://d1wl4jav5dp96l.cloudfront.net/original/2X/b/be3f308e59ddc64c34039cec077061a8c4c97637.png)

---

<div class="post-metadata">

**Author:** ![darcoli](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@darcoli](https://community.amazonquick.com/u/darcoli)\
**Post date:** [May 4, 2022, 4:35pm UTC](https://community.amazonquick.com/t/what-to-do-with-incorrect-calculated-field/3406/2 "2022-05-04T16:35:16Z")

</div>

This is one of the quirks of floating point numbers in computers… unfortunately with such low resolution you can hit such precision errors.

If your figures are always with 17 decimal places, you can try changing the calculation as below to try to force the datasource to work with integers instead

```auto
( decimalToInt(value_today * 100000000000000000) - decimalToInt(value_tomorrow * 100000000000000000)) 
/
100000000000000000

```

---

<div class="post-metadata">

**Author:** ![amber](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@amber](https://community.amazonquick.com/u/amber)\
**Post date:** [May 6, 2022, 4:03am UTC](https://community.amazonquick.com/t/what-to-do-with-incorrect-calculated-field/3406/3 "2022-05-06T04:03:11Z")

</div>

Thank you! It works! I tried limiting the decimal places for both the values and it seems that works too.
