# Want to Count the Total Occurence of Field values

**URL:** <https://discuss.elastic.co/t/want-to-count-the-total-occurence-of-field-values/103648>\
**Category:** Kibana\
**Created:** [October 12, 2017, 5:52am UTC](https://discuss.elastic.co/t/want-to-count-the-total-occurence-of-field-values/103648 "2017-10-12T05:52:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aditya\_soni](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@aditya\_soni](https://discuss.elastic.co/u/aditya_soni)\
**Post date:** [October 12, 2017, 5:52am UTC](https://discuss.elastic.co/t/want-to-count-the-total-occurence-of-field-values/103648/1 "2017-10-12T05:52:41Z")

</div>

Hi all,  
I need to make a visualization in which i have to get a total count of a field occurence.  
For Ex.i had applied a metric count on terms Response Code field but i get individual Response Code counts i.e.

> 91=5 times.  
> 100-6 times.  
> 12-4 times

* * *

> total- 15

so i just want to create the panel(Data table) which should be something like this.

```
Response Code Count(Column name)
          15 (Its data)

```

so how can i do that in kibana? is there any way i can write my own customize calculation for creating visualization?

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [October 12, 2017, 6:39am UTC](https://discuss.elastic.co/t/want-to-count-the-total-occurence-of-field-values/103648/2 "2017-10-12T06:39:31Z")

</div>

Hello Aditya,

I don't understand exactly what you want to visualize. You just want to visualize the number of documents, that had _any_ kind of value in the (let's call it): `responseCode` field, no matter what the value was?

In this case, you could just create a metric aggregation (which doesn't require splitting into any buckets or such), and apply the query `_exists_:responseCode` in the query bar on top of the visualization and leave the metric aggregation in the editor to "Count". That way the number will just show the amount of documents, that had a specific value in that column.

For your second question: You can basically write custom visualizations in JavaScript and plug them into Kibana. But this is still a of of trial and error, since we don't expose a proper API at the moment for that. Best would be to have a look at [existing plugins](https://www.elastic.co/guide/en/kibana/current/known-plugins.html) and check what they are doing.

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![aditya\_soni](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@aditya\_soni](https://discuss.elastic.co/u/aditya_soni)\
**Post date:** [October 12, 2017, 10:16am UTC](https://discuss.elastic.co/t/want-to-count-the-total-occurence-of-field-values/103648/3 "2017-10-12T10:16:36Z")

</div>

HI @timroes,

Thanks For your answer it is helpful for me to go a step ahead.  
Now i am able to count the Number of Response Code Occurence according to my condition by applying the Filters.  
So my next problem is,  
Since i have created the column **Declines** (count of Transaction that has Response Codes other than 0) below, Now i have to create a column with name **Total** (Total transaction which has Response Code 0 as well as response Code =anynumber),  
So For doing that i have to create a new metric **Count** , and i want to apply only the **ResponseCode exists** and ignore the **ResponseCode not equal to 0 filter** , This column i have to create into this visualization only.

 ![Overall Decline](https://us1.discourse-cdn.com/elastic/original/3X/d/7/d7df979525d391174185f8c7eedfca64f8877048.jpg)

---

<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:** [November 9, 2017, 10:16am UTC](https://discuss.elastic.co/t/want-to-count-the-total-occurence-of-field-values/103648/4 "2017-11-09T10:16:54Z")

</div>

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