# Subtract the values of a field with its average

**URL:** <https://discuss.elastic.co/t/subtract-the-values-of-a-field-with-its-average/166704>\
**Category:** Kibana\
**Created:** [February 1, 2019, 9:46am UTC](https://discuss.elastic.co/t/subtract-the-values-of-a-field-with-its-average/166704 "2019-02-01T09:46:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_ne](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Alex\_ne](https://discuss.elastic.co/u/Alex_ne)\
**Post date:** [February 1, 2019, 9:46am UTC](https://discuss.elastic.co/t/subtract-the-values-of-a-field-with-its-average/166704/1 "2019-02-01T09:46:04Z")

</div>

Hi all,

I am trying to figure out a way to subtract the values of a field with its relevant average and then compare it with the standard deviation of the field.  
Is there a way to perform such an operation with Kibana?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [February 22, 2019, 10:30am UTC](https://discuss.elastic.co/t/subtract-the-values-of-a-field-with-its-average/166704/2 "2019-02-22T10:30:51Z")

</div>

If the docs are sparse enough that each bucket only encompasses 1 document, then this could be done with the Math aggregation in TSVB, but other than that you cannot get 1 specific document as elasticsearch works mainly with aggregations (groups of documents).

---

<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:** [March 22, 2019, 10:30am UTC](https://discuss.elastic.co/t/subtract-the-values-of-a-field-with-its-average/166704/3 "2019-03-22T10:30:57Z")

</div>

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