# Rounding errors in DQL query

**URL:** <https://community.dynatrace.com/t/rounding-errors-in-dql-query/54044>\
**Category:** DQL\
**Tags:** dql\
**Created:** [November 11, 2025, 2:15pm UTC](https://community.dynatrace.com/t/rounding-errors-in-dql-query/54044 "2025-11-11T14:15:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rachel6842135](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@rachel6842135](https://community.dynatrace.com/u/rachel6842135)\
**Post date:** [November 11, 2025, 2:15pm UTC](https://community.dynatrace.com/t/rounding-errors-in-dql-query/54044/1 "2025-11-11T14:15:15Z")

</div>

I am trying to configure a Dashboard tile using DQL. I am able to pull the required data and run various calculations, however for the final stage I am trying to calculate an error rate, using total errors vs total numbers of calls

I can see the calculation is correct, however the output I am seeing is incorrect, due to rounding errors. An example I have is evidenced below, where I am hardcoding a value of 289, but when I divide this my 100 I see an output which is rounded down to the nearest integer (but with 2 decimal places visible)

![rachel6842135_0-1762870545378.png](https://global.discourse-cdn.com/dynatrace/original/3X/7/8/78bb463eed64a055c26c9030679cac19986b81ff.png)

![rachel6842135_1-1762870369527.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/4/e4b7a6ca1d9d3387eba5be0aaa0ab6522109cc84.png)

Is there a setting I am missing which is somehow converting my number to an Integer before re-adding decimal places? I haven’t been able to find anything - both fields are configured to show 2 decimal places in settings

Thanks

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [November 11, 2025, 2:32pm UTC](https://community.dynatrace.com/t/rounding-errors-in-dql-query/54044/2 "2025-11-11T14:32:32Z")

</div>

Hi.  
[@rachel6842135](https://community.dynatrace.com/user/97644)Could you paste your DQL?  
It’s hard to come up with/verify something if you don’t know the syntax  
It’s integer division. In DQL, if both operands are integers (e.g., 289 / 100 or count()/count()), the result is truncated to an integer first and only then formatted — so you see 2.00  
But try this:

```markup
| fieldsAdd errorRate2 = 289.0
| fieldsAdd errorRate3 = errorRate2 / 100.0 
| fieldsReplace errorRate3 = round(errorRate3, 2)

```

Or&nbsp;For a real error-rate calc (total errors vs total calls), make one side a double:

```markup
| summarize total_calls = count(), total_errors = sum(is_error)
| fieldsAdd error_rate =
    if(total_calls == 0, 0.0,
       100.0 * toDouble(total_errors) / toDouble(total_calls))
| fieldsReplace error_rate = round(error_rate, 2)

```

---

<div class="post-metadata">

**Author:** ![rachel6842135](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@rachel6842135](https://community.dynatrace.com/u/rachel6842135)\
**Post date:** [November 11, 2025, 3:11pm UTC](https://community.dynatrace.com/t/rounding-errors-in-dql-query/54044/3 "2025-11-11T15:11:18Z")

</div>

Thanks so much&nbsp;[@t\_pawlak](https://community.dynatrace.com/user/42367)&nbsp;- your second solution (converting to double before calculating) has worked perfectly 🙂
