# Get User Retention with Timelion

**URL:** https://discuss.elastic.co/t/get-user-retention-with-timelion/141521
**Category:** Kibana
**Tags:** timelion
**Created:** [July 25, 2018, 8:19am UTC](https://discuss.elastic.co/t/get-user-retention-with-timelion/141521 "2018-07-25T08:19:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![xdholy](https://avatars.discourse-cdn.com/v4/letter/x/7cd45c/32.png) [@xdholy](https://discuss.elastic.co/u/xdholy)
#### Post date: [July 25, 2018, 8:19am UTC](https://discuss.elastic.co/t/get-user-retention-with-timelion/141521/1 "2018-07-25T08:19:04Z")

</div>

Hi,  
I'm trying to visualize the user retention using Timelion.  
In order to do calculate the retention, I have to get **today's register user** count and **next day's " registered only 1 day" user count**.  
So far, I managed to get this 2 sheet separately.  
But I can't figure out how to hold the number of next day's data and use it into this day's expression.  
Is there any way I can do this? To cross 2 day data?

This is the expression i came out so far.  
`.es(q=' event : "login" AND param1 : 1 ', metric=cardinality:Id.keyword).label(register 1 day) , .es(q=' event:"register" ').label(register)`

---

<div class="post-metadata">

### Author: ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)
#### Post date: [July 25, 2018, 8:51am UTC](https://discuss.elastic.co/t/get-user-retention-with-timelion/141521/2 "2018-07-25T08:51:14Z")

</div>

i think what you are looking for is the `offset` setting:

`.es(q=' event : "login" AND param1 : 1 ', metric=cardinality:Id.keyword, offset=+1d).label(register 1 day), .es(q=' event:"register" ').label(register)`

you could then also substract one from another, for example:

`.subtract(.es(*), .es(*, offset=+1d))`

---

<div class="post-metadata">

### Author: ![xdholy](https://avatars.discourse-cdn.com/v4/letter/x/7cd45c/32.png) [@xdholy](https://discuss.elastic.co/u/xdholy)
#### Post date: [July 25, 2018, 8:57am UTC](https://discuss.elastic.co/t/get-user-retention-with-timelion/141521/3 "2018-07-25T08:57:57Z")

</div>

Yes! I just started to learn Timelion yesterday but I can't believe i forgot this.  
Thank you so 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: [August 22, 2018, 8:58am UTC](https://discuss.elastic.co/t/get-user-retention-with-timelion/141521/4 "2018-08-22T08:58:02Z")

</div>

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