# Aggregate value in columns

**URL:** <https://discuss.elastic.co/t/aggregate-value-in-columns/218942>\
**Category:** Kibana\
**Created:** [February 12, 2020, 10:19am UTC](https://discuss.elastic.co/t/aggregate-value-in-columns/218942 "2020-02-12T10:19:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhen12345](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhen12345/32/62522_2.png) [@zhen12345](https://discuss.elastic.co/u/zhen12345)\
**Post date:** [February 12, 2020, 10:19am UTC](https://discuss.elastic.co/t/aggregate-value-in-columns/218942/1 "2020-02-12T10:19:29Z")

</div>

Hi,  
I want to create a table aggregate the data in both rows and columns. But it seems to me that I can only aggregate the value in the row. Below is a more detailed description of my issue. Is there any possible way to solve it?

I am using elasticsearch-7.5.2 and kibana-7.5.2 for 64 bit Windows .

----Input data: is formatted as in Table 1 from Excel.  
----ElasticSearch Data:is then created based on the input data as shown in as in Table 2. for each record, we add \_index as " yearly\_exp\_2018 " , \_type as 'exp' and a unique \_id.  
----First Expected Table: is as in Table 3:

- Aggregate the records by the field " ASSET/LIABILITY CLASS "in the row,
- Also aggregate the records by the field " Borrower " in the column. Field " Borrower " has two values: "Sovereign" and "Non-Sovereign"
- calculate the sum of gross exposure for column "Sovereign" and "Non-Sovereign"
- show the percentage of each class as of the total in column "%"  
----Kibana Table for First Expected Table\*\* I can generate is as in Table 4:
- I cannot aggregate data in the column in Kibana. So Table 4 is what I get from Kibana. It can only slit the results into two different tables

 ![table1](https://us1.discourse-cdn.com/elastic/original/3X/e/5/e5d282240d368a3da0511c309ab06718cec2e606.png)  
 ![table2](https://us1.discourse-cdn.com/elastic/original/3X/d/6/d62674b9d5a72a4607e993be97cc4011187240a1.png)  
 ![table3](https://us1.discourse-cdn.com/elastic/original/3X/0/a/0a928a1f20e26013a2fde86d16c469360b147589.png)  
 ![table4](https://us1.discourse-cdn.com/elastic/original/3X/6/8/68e2a91799ecf6725ac62793d9931cd9027422a0.png)

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [February 12, 2020, 3:56pm UTC](https://discuss.elastic.co/t/aggregate-value-in-columns/218942/2 "2020-02-12T15:56:56Z")

</div>

Hi, unfortunately there is no support for pivoting tables, there is a github issue to track that request [https://github.com/elastic/kibana/issues/5049](https://github.com/elastic/kibana/issues/5049) and my sense is that it should be something doable with Canvas, maybe with a bit of visual hacking to coordinate tables and bar chats together to produce something close to your `Table 3` output.

Sorry for not giving you more concrete answers but more of a possible path.

---

<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:** [March 11, 2020, 3:57pm UTC](https://discuss.elastic.co/t/aggregate-value-in-columns/218942/3 "2020-03-11T15:57:00Z")

</div>

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