# Calculate between events

**URL:** <https://discuss.elastic.co/t/calculate-between-events/127226>\
**Category:** Kibana\
**Created:** [April 8, 2018, 7:30pm UTC](https://discuss.elastic.co/t/calculate-between-events/127226 "2018-04-08T19:30:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichouVS](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@MichouVS](https://discuss.elastic.co/u/MichouVS)\
**Post date:** [April 8, 2018, 7:30pm UTC](https://discuss.elastic.co/t/calculate-between-events/127226/1 "2018-04-08T19:30:05Z")

</div>

Hi guys,

When we log user action; after a specific action, we'd like to know what the most chosen option after that is. So say for example: we register 'SessionStart' and following that we have different options: 'Search' , 'Play' , 'Browse' or 'SessionEnd'. (Real data has a lot more options) The 'actions' are all in the same term.field and based on timestamp

How can I find out what the most chosen 'first' option is following the 'SessionStart'?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 8, 2018, 8:18pm UTC](https://discuss.elastic.co/t/calculate-between-events/127226/2 "2018-04-08T20:18:39Z")

</div>

How do you link the two events?

---

<div class="post-metadata">

**Author:** ![MichouVS](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@MichouVS](https://discuss.elastic.co/u/MichouVS)\
**Post date:** [April 9, 2018, 6:28am UTC](https://discuss.elastic.co/t/calculate-between-events/127226/3 "2018-04-09T06:28:38Z")

</div>

I'm not sure what you mean?

Within our index its under the same stringfield.

---

<div class="post-metadata">

**Author:** ![lfroment-datasweet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lfroment-datasweet/32/32908_2.png) [@lfroment-datasweet](https://discuss.elastic.co/u/lfroment-datasweet)\
**Post date:** [April 9, 2018, 9:46pm UTC](https://discuss.elastic.co/t/calculate-between-events/127226/4 "2018-04-09T21:46:35Z")

</div>

Hi,

if I got it well, a mere count on your term.field (not analysed) (Y-metric) splitted by terms on your term.field (X-bucket) the should do the trick.

Regards

Lionel

---

<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:** [May 7, 2018, 9:46pm UTC](https://discuss.elastic.co/t/calculate-between-events/127226/5 "2018-05-07T21:46:45Z")

</div>

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