# Set aggregation and how to visualize in Kibana

**URL:** https://discuss.elastic.co/t/set-aggregation-and-how-to-visualize-in-kibana/248928
**Category:** Kibana
**Created:** [September 17, 2020, 7:37am UTC](https://discuss.elastic.co/t/set-aggregation-and-how-to-visualize-in-kibana/248928 "2020-09-17T07:37:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![onTop](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@onTop](https://discuss.elastic.co/u/onTop)
#### Post date: [September 17, 2020, 7:37am UTC](https://discuss.elastic.co/t/set-aggregation-and-how-to-visualize-in-kibana/248928/1 "2020-09-17T07:37:45Z")

</div>

Hi,  
I have a unique requirement. Let's say I have 2 fields in my document.

1. Build Version
2. Defects

If X and Y are 2 build versions, I want to visualize defects that are common to X and Y and defects that are unique to X and Y. Is it possible to get even closer to what I want to achieve without repetition of values in the rows?

---

<div class="post-metadata">

### Author: ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)
#### Post date: [September 21, 2020, 2:24pm UTC](https://discuss.elastic.co/t/set-aggregation-and-how-to-visualize-in-kibana/248928/2 "2020-09-21T14:24:46Z")

</div>

hi @onTop,

I think you can probably do a count per defect, for your first use-case. "Defects that are common to X and Y".

In the data-table visualization:

- Add a terms-aggregation by `Defect` ("split row)"
- Add another terms-aggregation ("split row"))
  - will create term-agg for build-version X
  - will create term-agg for build-version Y

That will give you a table with 4 columns:

- defect-identifier
- build-versionX identifier
- build-versionY identifier
- count

The issue here is of course that you might have `0`-counts.

- You can filter these out be setting the `min_doc_count` to 1 in the advanced-\>JSON-input setting. (E.g. [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#\_minimum\_document\_count\_4](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_minimum_document_count_4) and [Custom search](https://discuss.elastic.co/t/custom-search/38591/2))
- Another ways it to just order by count-descending.

For the other use-case, defects that are only unique to one or the other, I'm not sure if you can out of the box. I would open an ER. [https://github.com/elastic/kibana/issues/new](https://github.com/elastic/kibana/issues/new)

---

<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 19, 2020, 2:24pm UTC](https://discuss.elastic.co/t/set-aggregation-and-how-to-visualize-in-kibana/248928/3 "2020-10-19T14:24:53Z")

</div>

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