# Cant see correctly percentage in Timelion

**URL:** <https://discuss.elastic.co/t/cant-see-correctly-percentage-in-timelion/234292>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [May 26, 2020, 9:38am UTC](https://discuss.elastic.co/t/cant-see-correctly-percentage-in-timelion/234292 "2020-05-26T09:38:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandros888](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Alexandros888](https://discuss.elastic.co/u/Alexandros888)\
**Post date:** [May 26, 2020, 9:38am UTC](https://discuss.elastic.co/t/cant-see-correctly-percentage-in-timelion/234292/1 "2020-05-26T09:38:55Z")

</div>

Hello,

As the following image show i am trying to calculate 4 things with timelion.

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

1. number of orders in my erp

2. numbers of orders in my erp one week ago

3. the difference between previous numbers 1 and 2

4. to show the same difference also as a percentage.

Steps 1,2,3 work fine. Nevertheless step 4 doesn't work.

The code that i use for each step respectively is the following:

```
.es(index=connect-*, q='order_type:order and event_type.keyword:order').label('Orders AX'),

.es(index=connect-*, q='order_type:order and event_type.keyword:order',offset=-1w).label('1 week ago'),

.es(index=connect-*, q='order_type:order and event_type.keyword:order').subtract(.es(index=connect-*, q='order_type:order and event_type.keyword:order',offset=-1w)).label("Difference previous week"),

.es(index=connect-*, q='order_type:order and event_type.keyword:order').subtract(.es(index=connect-*, q='order_type:order and event_type.keyword:order',offset=-1w)).divide(.es(index=connect-*, q='order_type:order and event_type.keyword:order')).label('Difference with previous week in Percentage')

```

What shall i correct in step 4 so i can also see the difference in percentage correctly?

---

<div class="post-metadata">

**Author:** ![Dzmitry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dzmitry/32/65026_2.png) [@Dzmitry](https://discuss.elastic.co/u/Dzmitry)\
**Post date:** [May 26, 2020, 10:59am UTC](https://discuss.elastic.co/t/cant-see-correctly-percentage-in-timelion/234292/2 "2020-05-26T10:59:44Z")

</div>

Hi @Alexandros888,

Could you try adding it to your 4th script before `.label`:

`.multiply(100).yaxis(units="custom::%")`

Regards, Dzmitry

---

<div class="post-metadata">

**Author:** ![Alexandros888](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Alexandros888](https://discuss.elastic.co/u/Alexandros888)\
**Post date:** [May 26, 2020, 11:25am UTC](https://discuss.elastic.co/t/cant-see-correctly-percentage-in-timelion/234292/3 "2020-05-26T11:25:01Z")

</div>

Hello

Thank you for your quick response.

I tried your change like that:

```
.es(index=connect-*, q='order_type:order and event_type.keyword:order').label('Orders AX'),

.es(index=connect-*, q='order_type:order and event_type.keyword:order',offset=-1w).label('1 week ago'),

.es(index=connect-*, q='order_type:order and event_type.keyword:order').subtract(.es(index=connect-*, q='order_type:order and event_type.keyword:order',offset=-1w)).label("Difference previous week"),

.es(index=connect-*, q='order_type:order and event_type.keyword:order').subtract(.es(index=connect-*, q='order_type:order and event_type.keyword:order',offset=-1w)).divide(.es(index=connect-*, q='order_type:order and event_type.keyword:order')).multiply(100).yaxis(units="custom::%").label('Difference with previous week in Percentage')

```

Unfortunately now it shows everything in percentage

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

i want only the fourth section in percentage

---

<div class="post-metadata">

**Author:** ![Dzmitry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dzmitry/32/65026_2.png) [@Dzmitry](https://discuss.elastic.co/u/Dzmitry)\
**Post date:** [May 26, 2020, 2:12pm UTC](https://discuss.elastic.co/t/cant-see-correctly-percentage-in-timelion/234292/4 "2020-05-26T14:12:43Z")

</div>

@Alexandros888,

Since you have a mix of absolute and percentage values, try just using

`.multiply(100)`

It should fix the data.

Regards, Dzmitry

---

<div class="post-metadata">

**Author:** ![Alexandros888](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Alexandros888](https://discuss.elastic.co/u/Alexandros888)\
**Post date:** [May 27, 2020, 5:59am UTC](https://discuss.elastic.co/t/cant-see-correctly-percentage-in-timelion/234292/5 "2020-05-27T05:59:07Z")

</div>

Hello Dzmitry,

As you said i changed it like that:

`.es(index=connect-*, q='order_type:order and event_type.keyword:order').subtract(.es(index=connect-*, q='order_type:order and event_type.keyword:order',offset=-1w)).divide(.es(index=connect-*, q='order_type:order and event_type.keyword:order')).multiply(100).label("Difference previous week in Percentage %")`

and it worked 🙂  
Thank you very much !!!!

---

<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 24, 2020, 5:59am UTC](https://discuss.elastic.co/t/cant-see-correctly-percentage-in-timelion/234292/6 "2020-06-24T05:59:10Z")

</div>

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