# How to calculate count of particular fields in data table in Kibana?

**URL:** https://discuss.elastic.co/t/how-to-calculate-count-of-particular-fields-in-data-table-in-kibana/233014
**Category:** Kibana
**Created:** [May 17, 2020, 9:30pm UTC](https://discuss.elastic.co/t/how-to-calculate-count-of-particular-fields-in-data-table-in-kibana/233014 "2020-05-17T21:30:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jaishree\_Pal](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@Jaishree\_Pal](https://discuss.elastic.co/u/Jaishree_Pal)
#### Post date: [May 17, 2020, 9:30pm UTC](https://discuss.elastic.co/t/how-to-calculate-count-of-particular-fields-in-data-table-in-kibana/233014/1 "2020-05-17T21:30:29Z")

</div>

Hi guys, I want to add some columns like pass/fail/total in my data table, but I don't know how to calculate the count of results and display them on data table.  
For example, my records have following fields:  
Version, feature name, testcase name, result .

I want to display on data table that how many testcases have pass/fail results when a particualr version and feature is used as a filter. So, the columns I want in my data table are:  
Version, Feature, Total results(count of results under this feature), Pass(count of results having status as "Pass"), Fail(count of results having status as "Fail").

Please help me to achieve this.

---

<div class="post-metadata">

### Author: ![lukeelmers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukeelmers/32/35230_2.png) [@lukeelmers](https://discuss.elastic.co/u/lukeelmers)
#### Post date: [May 18, 2020, 5:16pm UTC](https://discuss.elastic.co/t/how-to-calculate-count-of-particular-fields-in-data-table-in-kibana/233014/2 "2020-05-18T17:16:10Z")

</div>

@Jaishree_Pal It sounds like what you are looking for is a [bucket script aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html), which will let you compute numbers based on the results of other buckets.

These are supported in [TSVB](https://www.elastic.co/guide/en/kibana/current/TSVB.html), but not yet supported in other Kibana visualizations. TSVB does have a data table, so I'd recommend starting there: It provides a UI where you can enter the script you want to run on each of the buckets. You'll find some example scripts in the docs I linked to above.

If TSVB doesn't work for your use case, then you can [follow along with the Github issue](https://github.com/elastic/kibana/issues/4707) which tracks wider implementation of bucket scripts across all Kibana core visualizations.

---

<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: [June 15, 2020, 5:25pm UTC](https://discuss.elastic.co/t/how-to-calculate-count-of-particular-fields-in-data-table-in-kibana/233014/3 "2020-06-15T17:25:05Z")

</div>

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