# Difference of two counts on a "metric" visualization object

**URL:** <https://discuss.elastic.co/t/difference-of-two-counts-on-a-metric-visualization-object/249981>\
**Category:** Kibana\
**Created:** [September 25, 2020, 1:04pm UTC](https://discuss.elastic.co/t/difference-of-two-counts-on-a-metric-visualization-object/249981 "2020-09-25T13:04:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpdieego](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@rpdieego](https://discuss.elastic.co/u/rpdieego)\
**Post date:** [September 25, 2020, 1:04pm UTC](https://discuss.elastic.co/t/difference-of-two-counts-on-a-metric-visualization-object/249981/1 "2020-09-25T13:04:29Z")

</div>

Hello Everyone,

I'm working on a project where our goal is to monitor a series of systems, and it's important to us to understand if the number of messages were the same on the outputs of each of these systems.

In order to achieve that, I was looking for building a visualization object, using the "metric" object, where I could display the difference of counts of two events.

I can easily build a count visualization for one event, but I couldn't find out a way to perform a subtraction. I wasn't able to find some instructions on my research regarding this topic as well.

Could anyone give me a hand on this?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [September 30, 2020, 6:54pm UTC](https://discuss.elastic.co/t/difference-of-two-counts-on-a-metric-visualization-object/249981/2 "2020-09-30T18:54:15Z")

</div>

Hello,

You should be able to use scripted fields for doing your math and then using that in your visualization [https://www.elastic.co/guide/en/kibana/current/scripted-fields.html](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html).  
I think TSVB visualization will also help because you can do math - [https://www.elastic.co/guide/en/kibana/current/TSVB.html](https://www.elastic.co/guide/en/kibana/current/TSVB.html)

Thanks,  
Bhavya

---

<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:** [October 28, 2020, 6:54pm UTC](https://discuss.elastic.co/t/difference-of-two-counts-on-a-metric-visualization-object/249981/3 "2020-10-28T18:54:39Z")

</div>

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