# \[Timelion\] Integer Divides int does not result in decimal value

**URL:** <https://discuss.elastic.co/t/timelion-integer-divides-int-does-not-result-in-decimal-value/165929>\
**Category:** Kibana\
**Created:** [January 28, 2019, 4:37am UTC](https://discuss.elastic.co/t/timelion-integer-divides-int-does-not-result-in-decimal-value/165929 "2019-01-28T04:37:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelcheung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michaelcheung/32/53285_2.png) [@michaelcheung](https://discuss.elastic.co/u/michaelcheung)\
**Post date:** [January 28, 2019, 4:37am UTC](https://discuss.elastic.co/t/timelion-integer-divides-int-does-not-result-in-decimal-value/165929/1 "2019-01-28T04:37:14Z")

</div>

This is my expression displaying average user actions.

```auto
.es("user:*", metric=cardinality:user).color(#FF0000).label(user),
.es("action:*", metric=sum:actionCount).divide(.es("user:*", metric=cardinality:user)).color(#333300).label(avg action)

```

When I hover on the graph, the second line's average values are integers. I suspect it is because both `cardinality:user` and `sum:actionCount` are integers. I tried to append the second expression with `.precision(4)` and it, expectedly, does not work.

Can I make it compute decimal results in this case?

Edit: I also tried to `.multiply(1.0)` before `.divide()` that fails also.

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [January 28, 2019, 1:30pm UTC](https://discuss.elastic.co/t/timelion-integer-divides-int-does-not-result-in-decimal-value/165929/2 "2019-01-28T13:30:31Z")

</div>

Hey @michaelcheung,

Is it only the legends that fail to show decimal values, or does the plot show incorrect data too?  
You might be running into this issue: [https://github.com/elastic/kibana/issues/17379](https://github.com/elastic/kibana/issues/17379)

---

<div class="post-metadata">

**Author:** ![michaelcheung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michaelcheung/32/53285_2.png) [@michaelcheung](https://discuss.elastic.co/u/michaelcheung)\
**Post date:** [January 30, 2019, 7:35am UTC](https://discuss.elastic.co/t/timelion-integer-divides-int-does-not-result-in-decimal-value/165929/3 "2019-01-30T07:35:12Z")

</div>

You are right. It is issue on legends. The curves are fine.

In my opinion, shouldn't it be considered a low priority bug, rather than an enhancement issue?

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [January 30, 2019, 11:24am UTC](https://discuss.elastic.co/t/timelion-integer-divides-int-does-not-result-in-decimal-value/165929/4 "2019-01-30T11:24:03Z")

</div>

Yep, I agree this is a bug rather than an enhancement. I can make that change 👍

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 27, 2019, 11:24am UTC](https://discuss.elastic.co/t/timelion-integer-divides-int-does-not-result-in-decimal-value/165929/5 "2019-02-27T11:24:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
