# Why timelion .sum() is not working

**URL:** <https://discuss.elastic.co/t/why-timelion-sum-is-not-working/123670>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [March 13, 2018, 2:23am UTC](https://discuss.elastic.co/t/why-timelion-sum-is-not-working/123670 "2018-03-13T02:23:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerrychen](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jerrychen](https://discuss.elastic.co/u/jerrychen)\
**Post date:** [March 13, 2018, 2:23am UTC](https://discuss.elastic.co/t/why-timelion-sum-is-not-working/123670/1 "2018-03-13T02:23:05Z")

</div>

env: es 6.2, kibana 6.2  
I what to graph the total disk io bandwidth.  
First,I get the graph group by ipaddr.

 ![2018-03-13%2009_53_58-Timelion%20-%20Kibana-1](https://us1.discourse-cdn.com/elastic/original/3X/b/6/b615ba56dfec06e2ccf595b44189dbff404f35ab.png)

Then, when i do .sum(),it return nothing.

 ![2018-03-13%2009_55_19-Timelion%20-%20Kibana%202](https://us1.discourse-cdn.com/elastic/original/3X/4/2/42c181b409af33d2a6978bd46e114a2ab103d015.png)

Finally,I add .abs() before .sum(),it works.  
 ![2018-03-13%2009_56_08-Timelion%20-%20Kibana%203](https://us1.discourse-cdn.com/elastic/original/3X/7/c/7c53135e471808450f83f03220dde79016ec73a4.png)

My questions:

1. Why .sum() in step 2 is not working?

2. I am not sure the result of .abs().sum() is right.

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [March 14, 2018, 3:35am UTC](https://discuss.elastic.co/t/why-timelion-sum-is-not-working/123670/2 "2018-03-14T03:35:32Z")

</div>

I assume it's because some of your series have missing data for some periods, which breaks the `.sum()` function. If you use `.fit()` or `.abs()` then it will ensure that every bucket has a value and `.sum()` will work as intended.

---

<div class="post-metadata">

**Author:** ![jerrychen](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jerrychen](https://discuss.elastic.co/u/jerrychen)\
**Post date:** [March 14, 2018, 8:49am UTC](https://discuss.elastic.co/t/why-timelion-sum-is-not-working/123670/3 "2018-03-14T08:49:29Z")

</div>

What will the .fit() or .abs() return,if it is no data?

Is there any doc about example of all math functions?

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [March 14, 2018, 11:07pm UTC](https://discuss.elastic.co/t/why-timelion-sum-is-not-working/123670/4 "2018-03-14T23:07:52Z")

</div>

`.fit()` is configurable and returns different values based on the mode you choose. "carry" will reuse the most recent value when there is no data. "nearest" will do the same, except that it uses the nearest, not just the most recent, so sometimes it will use the next data point. "scale" will interpolate data points so that the gaps transition "smoothly" (if your data was `[1, null, null, 4]`, "scale" would produce `[1,2,3,4]`).

`.abs()` is just going to fill in `null` points with `0` I believe, didn't realize it did that until reading your post though 🙂

The documentation for each function is visible in the autocomplete and the "help" tab, but most functions could use a bit more color.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/a/ba6fc9aecd7f21f3c22e76d04e8a794c8815973a.png)

---

<div class="post-metadata">

**Author:** ![jerrychen](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jerrychen](https://discuss.elastic.co/u/jerrychen)\
**Post date:** [March 15, 2018, 2:23am UTC](https://discuss.elastic.co/t/why-timelion-sum-is-not-working/123670/5 "2018-03-15T02:23:27Z")

</div>

The timelion "help" just list the keyword,I want to get the reference like your explaination.

Thinks for your help!

---

<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:** [April 12, 2018, 2:23am UTC](https://discuss.elastic.co/t/why-timelion-sum-is-not-working/123670/6 "2018-04-12T02:23:36Z")

</div>

Closed on April 12, 2018, 2:23am UTC

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