# Divide Series by Count all Records in same index

**URL:** <https://discuss.elastic.co/t/divide-series-by-count-all-records-in-same-index/164508>\
**Category:** Kibana\
**Created:** [January 16, 2019, 4:51pm UTC](https://discuss.elastic.co/t/divide-series-by-count-all-records-in-same-index/164508 "2019-01-16T16:51:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mariner191](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mariner191](https://discuss.elastic.co/u/Mariner191)\
**Post date:** [January 16, 2019, 4:51pm UTC](https://discuss.elastic.co/t/divide-series-by-count-all-records-in-same-index/164508/1 "2019-01-16T16:51:19Z")

</div>

Hello, as a noob, How to divide one Series by “Count” of all Records within the same index\*?  
Closest information found here [https://www.timroes.de/2017/08/02/timelion-tutorial-from-zero-to-hero/](https://www.timroes.de/2017/08/02/timelion-tutorial-from-zero-to-hero/)

Thank you!

 ![Kibana_Timelion_HowTo_on_Forum](https://us1.discourse-cdn.com/elastic/original/3X/8/f/8fb1297dae2e8c27acb438bf6ba83e44e4aa4cd4.jpeg)

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [January 17, 2019, 11:00am UTC](https://discuss.elastic.co/t/divide-series-by-count-all-records-in-same-index/164508/2 "2019-01-17T11:00:15Z")

</div>

Hi,

basically you just put a `.divide(.es(..))` behind your series. So for example:

```auto
.es(index=ind, q=somefield:value, timefield=time).divide(.es(index=ind, timefield=time)).label('Blue').color(blue)

```

Will devide all documents matching that query, by the number of all documents in ES for that specific time slot.

Does this help solving your problem?

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![Mariner191](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mariner191](https://discuss.elastic.co/u/Mariner191)\
**Post date:** [January 17, 2019, 1:43pm UTC](https://discuss.elastic.co/t/divide-series-by-count-all-records-in-same-index/164508/3 "2019-01-17T13:43:38Z")

</div>

Hi Tim,

Thank you for checking this out. Perhaps a punctuation error?

 ![](https://us1.discourse-cdn.com/elastic/original/3X/a/f/af06bfbd1e2863152970c05c5b7d73095033e72e.jpeg)

Thank you,

Mark

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [January 17, 2019, 1:49pm UTC](https://discuss.elastic.co/t/divide-series-by-count-all-records-in-same-index/164508/4 "2019-01-17T13:49:22Z")

</div>

I think you forgot the closing parenthesis for the .divide function and just have one for the .es function, but unfortunately that part is blacked out in your screenshot, so I can only guess 🙂

---

<div class="post-metadata">

**Author:** ![Mariner191](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mariner191](https://discuss.elastic.co/u/Mariner191)\
**Post date:** [January 17, 2019, 2:02pm UTC](https://discuss.elastic.co/t/divide-series-by-count-all-records-in-same-index/164508/5 "2019-01-17T14:02:14Z")

</div>

Yes, closing parenthesis was the issue.  
Thank you!

---

<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 14, 2019, 2:02pm UTC](https://discuss.elastic.co/t/divide-series-by-count-all-records-in-same-index/164508/6 "2019-02-14T14:02:20Z")

</div>

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