# How to visualize difference between two fields

**URL:** <https://discuss.elastic.co/t/how-to-visualize-difference-between-two-fields/101362>\
**Category:** Kibana\
**Created:** [September 21, 2017, 3:39pm UTC](https://discuss.elastic.co/t/how-to-visualize-difference-between-two-fields/101362 "2017-09-21T15:39:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pola](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@Pola](https://discuss.elastic.co/u/Pola)\
**Post date:** [September 21, 2017, 3:39pm UTC](https://discuss.elastic.co/t/how-to-visualize-difference-between-two-fields/101362/1 "2017-09-21T15:39:41Z")

</div>

Hi,

I have 'setcount' and 'clearedcount' number fields which i added in logstash when it finds "set" in message field setcount is set to 1 and if it finds "clear" in message filed it sets clearedcount to 1.

each event will have either setcount or clearedcount.

I wanted to visualize something like setcount - clearedcount per host.

How can i acheive this in visualization.

---

<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 21, 2017, 8:05pm UTC](https://discuss.elastic.co/t/how-to-visualize-difference-between-two-fields/101362/2 "2017-09-21T20:05:28Z")

</div>

Hi Pola,

You can use a scripted field here. Here is where you will add it:

 ![scripted_field](https://us1.discourse-cdn.com/elastic/original/3X/a/2/a2e8d8c89547afcb7d2b5e036a91ea8e30a991f8.jpg)

Once you do you can use any basic chart to do your aggregation on it.

Thanks,  
Bhavya

---

<div class="post-metadata">

**Author:** ![Pola](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@Pola](https://discuss.elastic.co/u/Pola)\
**Post date:** [September 25, 2017, 3:46pm UTC](https://discuss.elastic.co/t/how-to-visualize-difference-between-two-fields/101362/3 "2017-09-25T15:46:19Z")

</div>

Thanks bhavyarm! I ended up in doing the same thing and it worked. Thanks for sharing.

---

<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 23, 2017, 3:46pm UTC](https://discuss.elastic.co/t/how-to-visualize-difference-between-two-fields/101362/4 "2017-10-23T15:46:22Z")

</div>

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