# Timelion - derivative and labels

**URL:** <https://discuss.elastic.co/t/timelion-derivative-and-labels/139922>\
**Category:** Kibana\
**Created:** [July 13, 2018, 10:23am UTC](https://discuss.elastic.co/t/timelion-derivative-and-labels/139922 "2018-07-13T10:23:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angelos](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Angelos](https://discuss.elastic.co/u/Angelos)\
**Post date:** [July 13, 2018, 10:23am UTC](https://discuss.elastic.co/t/timelion-derivative-and-labels/139922/1 "2018-07-13T10:23:03Z")

</div>

Hello!

I am trying to implement derivative, splitting between products and then If the result is greater than 2000 I want to show(label) the top 5 products with this result. Can we do that?  
I tried the series below but it shows all 80 labels while I need only the top 5.

.es(index=test, timefield=time, metric=max:result, split=product:80).fit(carry).derivative().abs().if(gte, 2000, .es(index=test, timefield=time, metric=max:result, split=product:5).fit(carry).derivative().abs().label(" Result of [$1]", "^.\* \> product.keyword:(\S+) \> .\*"), null).points()

Thank you very much in advance!

Angelos

---

<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:** [July 13, 2018, 11:21am UTC](https://discuss.elastic.co/t/timelion-derivative-and-labels/139922/2 "2018-07-13T11:21:17Z")

</div>

Hi Angelos,

I think that is unfortunately not possible. I tried to play around with, but can't achieve a result, that looks close to what you mention. Though I am not 100% sure I understand completely what result you imagine. Do you want for each timeslot on the x axis the 5 products with the highest derivative of the maximum in the `result` field? Or only the top 5, that had a derivative above 2000?

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![Angelos](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Angelos](https://discuss.elastic.co/u/Angelos)\
**Post date:** [July 13, 2018, 11:44am UTC](https://discuss.elastic.co/t/timelion-derivative-and-labels/139922/3 "2018-07-13T11:44:49Z")

</div>

Hi Tim,

Thank you for your fast response!  
The second one. I want the top 5 products, that had derivative above 2000.  
I have many products(80) so it is difficult to label them clearly, thats why I want sort them.  
For example, there are products that reach over 2000 and I cannot see them because the label list is too long.

Cheers,  
Angelos

---

<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:** [August 10, 2018, 11:44am UTC](https://discuss.elastic.co/t/timelion-derivative-and-labels/139922/4 "2018-08-10T11:44:53Z")

</div>

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