# Dynamic label in Timelion doesn't work as expected

**URL:** <https://discuss.elastic.co/t/dynamic-label-in-timelion-doesnt-work-as-expected/183249>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [May 29, 2019, 7:18am UTC](https://discuss.elastic.co/t/dynamic-label-in-timelion-doesnt-work-as-expected/183249 "2019-05-29T07:18:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eduardo\_De\_Zulueta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eduardo_de_zulueta/32/47037_2.png) [@Eduardo\_De\_Zulueta](https://discuss.elastic.co/u/Eduardo_De_Zulueta)\
**Post date:** [May 29, 2019, 7:18am UTC](https://discuss.elastic.co/t/dynamic-label-in-timelion-doesnt-work-as-expected/183249/1 "2019-05-29T07:18:55Z")

</div>

Hi,  
I was trying to generate a Timelion graph using the split feature and also dynamic labels but the result is not as expected:

`.es(index=transaction.es*, timefield='time',q='status:KO', split='site.keyword:10').multiply(100).divide(.es(index=transaction.es*, timefield='time',q='status:OK OR status:KO')).yaxis(2).label("[$1]", "^.* > site.keyword:(\S+) > .*")`

my desired output is the KO ratio by site, and the actual output is:

 ![14](https://us1.discourse-cdn.com/elastic/original/3X/5/8/58e86ae820e459c1d30b3a5ba2e79cee1abb6881.png)

As you can see int the graph the KO ratio for the site with higher volume is around 9% but its not real because the ratio for this site is around 50%

 ![32](https://us1.discourse-cdn.com/elastic/original/3X/9/9/9955ada6dce7a788b750c625f3ace0f66074b69f.png)

Then the split by site.keyword for all the sites is not OK, due to the ratio is calculated grouping all the sites.  
Do you know any idea to solve it?

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [May 29, 2019, 4:07pm UTC](https://discuss.elastic.co/t/dynamic-label-in-timelion-doesnt-work-as-expected/183249/2 "2019-05-29T16:07:37Z")

</div>

Hey @Eduardo_De_Zulueta, you'll want to add the "split" parameter to the second `.es` statement:

```auto
.es(index=transaction.es*, timefield='time',q='status:KO', split='site.keyword:10').multiply(100).divide(.es(index=transaction.es*, timefield='time',q='status:OK OR status:KO',split='site.keyword:10')).yaxis(2).label("[$1]", "^.* > site.keyword:(\S+) > .*")

```

---

<div class="post-metadata">

**Author:** ![Eduardo\_De\_Zulueta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eduardo_de_zulueta/32/47037_2.png) [@Eduardo\_De\_Zulueta](https://discuss.elastic.co/u/Eduardo_De_Zulueta)\
**Post date:** [May 30, 2019, 6:16am UTC](https://discuss.elastic.co/t/dynamic-label-in-timelion-doesnt-work-as-expected/183249/3 "2019-05-30T06:16:21Z")

</div>

Hi @Brandon_Kobel, thanks a lot, now it works perfect!

---

<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:** [June 27, 2019, 6:16am UTC](https://discuss.elastic.co/t/dynamic-label-in-timelion-doesnt-work-as-expected/183249/4 "2019-06-27T06:16:24Z")

</div>

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