# Timelion cusum not working with log?

**URL:** <https://discuss.elastic.co/t/timelion-cusum-not-working-with-log/259645>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [December 25, 2020, 4:30pm UTC](https://discuss.elastic.co/t/timelion-cusum-not-working-with-log/259645 "2020-12-25T16:30:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgeRD](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/georgerd/32/77165_2.png) [@georgeRD](https://discuss.elastic.co/u/georgeRD)\
**Post date:** [December 25, 2020, 4:30pm UTC](https://discuss.elastic.co/t/timelion-cusum-not-working-with-log/259645/1 "2020-12-25T16:30:57Z")

</div>

I have created a graph in timelion that generates daily returns using data from an index that keeps the daily balance of an account. The code is the following:

```auto
.es(index=daily_account,q="account:1794",metric=sum:daily_pnl,timefield=date_closed).derivative().precision(8).divide(.es(index=daily_account,q="account:1794",metric=sum:equity,timefield=date_closed).precision(8).subtract(.es(index=daily_account,q="account:1794",metric=sum:daily_pnl,timefield=date_closed).derivative())).plus(.static(1)).precision(8).log(2.71828)

```

The code works fine and returns a line with returns on a daily basis. When I try to get a cumulative sum though of the above by adding .cusum(), nothing is returned. I was wondering if there is an issue with using log and cusum together but I could not find anything. Any ideas will be greatly appreciated.  
Kibana version: 6.8.10

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [December 28, 2020, 12:54pm UTC](https://discuss.elastic.co/t/timelion-cusum-not-working-with-log/259645/2 "2020-12-28T12:54:17Z")

</div>

There isn't any know issue that I'm aware of. Can you check the request made by Timelion in your browser's network tab and post it here? We can try and debug from there.

---

<div class="post-metadata">

**Author:** ![georgeRD](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/georgerd/32/77165_2.png) [@georgeRD](https://discuss.elastic.co/u/georgeRD)\
**Post date:** [December 30, 2020, 4:27pm UTC](https://discuss.elastic.co/t/timelion-cusum-not-working-with-log/259645/3 "2020-12-30T16:27:10Z")

</div>

Thanks for your response @Marius_Dragomir, your request actually showed me the way to find the cause. The initial request has null value in the first bucket, which is the reason the cusum request fails. Not sure if this the expected behaviour, nevertheless I applied a condition to replace with 0 if null and now cusum() works.

Thanks a lot! You can consider this issue closed.

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [December 30, 2020, 4:44pm UTC](https://discuss.elastic.co/t/timelion-cusum-not-working-with-log/259645/4 "2020-12-30T16:44:43Z")

</div>

That sounds indeed like not an expected behavior. Can you open an issue here please? [https://github.com/elastic/kibana/](https://github.com/elastic/kibana/)

---

<div class="post-metadata">

**Author:** ![georgeRD](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/georgerd/32/77165_2.png) [@georgeRD](https://discuss.elastic.co/u/georgeRD)\
**Post date:** [December 30, 2020, 7:51pm UTC](https://discuss.elastic.co/t/timelion-cusum-not-working-with-log/259645/5 "2020-12-30T19:51:44Z")

</div>

Issue created [https://github.com/elastic/kibana/issues/87077](https://github.com/elastic/kibana/issues/87077)

---

<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:** [January 27, 2021, 7:52pm UTC](https://discuss.elastic.co/t/timelion-cusum-not-working-with-log/259645/6 "2021-01-27T19:52:01Z")

</div>

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