# Calculate difference between current and previous values

**URL:** <https://discuss.elastic.co/t/calculate-difference-between-current-and-previous-values/302237>\
**Category:** Beats\
**Tags:** elastic-stack-monitoring, metricbeat\
**Created:** [April 12, 2022, 1:58pm UTC](https://discuss.elastic.co/t/calculate-difference-between-current-and-previous-values/302237 "2022-04-12T13:58:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![700grm](https://avatars.discourse-cdn.com/v4/letter/7/3ec8ea/32.png) [@700grm](https://discuss.elastic.co/u/700grm)\
**Post date:** [April 12, 2022, 1:58pm UTC](https://discuss.elastic.co/t/calculate-difference-between-current-and-previous-values/302237/1 "2022-04-12T13:58:37Z")

</div>

Hi, I'm trying to create Watcher Alert for dropped packets `system.network.in.dropped` (the system metrics are shipped with Metricbeats) if more than 50 dropped packets are present alert should be generated. To do this I need calculate difference between current and previous values.

 ![Screenshot 2022-04-12 141935](https://us1.discourse-cdn.com/elastic/original/3X/4/d/4dcce806ac6a2a0504290d536e8988f70851c25a.png)

What is the best way of doing it?

---

<div class="post-metadata">

**Author:** ![anime\_lover](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anime_lover/32/100265_2.png) [@anime\_lover](https://discuss.elastic.co/u/anime_lover)\
**Post date:** [April 13, 2022, 12:11pm UTC](https://discuss.elastic.co/t/calculate-difference-between-current-and-previous-values/302237/2 "2022-04-13T12:11:09Z")

</div>

i hope derivative aggregation might help in this situation.

---

<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 11, 2022, 2:11pm UTC](https://discuss.elastic.co/t/calculate-difference-between-current-and-previous-values/302237/3 "2022-05-11T14:11:39Z")

</div>

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