# Finding difference between 2 rows in Kibana Visualtisation

**URL:** <https://discuss.elastic.co/t/finding-difference-between-2-rows-in-kibana-visualtisation/170691>\
**Category:** Kibana\
**Created:** [March 4, 2019, 8:54am UTC](https://discuss.elastic.co/t/finding-difference-between-2-rows-in-kibana-visualtisation/170691 "2019-03-04T08:54:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pranav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pranav/32/135850_2.png) [@Pranav](https://discuss.elastic.co/u/Pranav)\
**Post date:** [March 4, 2019, 8:54am UTC](https://discuss.elastic.co/t/finding-difference-between-2-rows-in-kibana-visualtisation/170691/1 "2019-03-04T08:54:36Z")

</div>

I was trying to find the difference between 2 timestamps in Kibana table see in the

 ![13%20PM](https://us1.discourse-cdn.com/elastic/original/3X/0/3/03b4cce5dca7984241d94fda52300e0477e788df.png)

I want to create a field calculating the time difference between 1st timestamp ie February 20th 2019, 14:06:11.868 and 2nd ie February 20th 2019, 14:06:14.856 and get a field lets say "time\_diff" in the table.  
How can this be achieved in ELK?

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [March 5, 2019, 5:44pm UTC](https://discuss.elastic.co/t/finding-difference-between-2-rows-in-kibana-visualtisation/170691/2 "2019-03-05T17:44:08Z")

</div>

> I want to create a field calculating the time difference between 1st timestamp ie February 20th 2019, 14:06:11.868 and 2nd ie February 20th 2019, 14:06:14.856 and get a field lets say "time\_diff" in the table.

That is not possible in Kibana. I would recommend adding `time_diff` to the document at ingest (before insert, look up the previous document that relates to this one, calculate the diff, and add a new field containing that value). That way, the field will be available for use in Kibana.

---

<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:** [April 2, 2019, 5:44pm UTC](https://discuss.elastic.co/t/finding-difference-between-2-rows-in-kibana-visualtisation/170691/3 "2019-04-02T17:44:14Z")

</div>

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