# Doing computation on count aggregation in heatmap

**URL:** <https://discuss.elastic.co/t/doing-computation-on-count-aggregation-in-heatmap/254513>\
**Category:** Elasticsearch\
**Created:** [November 6, 2020, 10:16am UTC](https://discuss.elastic.co/t/doing-computation-on-count-aggregation-in-heatmap/254513 "2020-11-06T10:16:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![josefy](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@josefy](https://discuss.elastic.co/u/josefy)\
**Post date:** [November 6, 2020, 10:16am UTC](https://discuss.elastic.co/t/doing-computation-on-count-aggregation-in-heatmap/254513/1 "2020-11-06T10:16:11Z")

</div>

Hi,  
I created a heatmap visualization. For the x-axis I have a date histogram, for the y-axis I have a "Terms" aggregation. For metrics I'm currently using the "Count" aggregation.

What I actually want is the "Count" divided by the sum of all "Count" aggregations of the same column. Mathematically, I want this:  
Let c[i,j] = the Count of cell of column i and row j, then I want c[i,j] / sum\_{k=1}^N c[i,k] where N is the number of rows.

Is this possible?

---

<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:** [December 4, 2020, 10:16am UTC](https://discuss.elastic.co/t/doing-computation-on-count-aggregation-in-heatmap/254513/2 "2020-12-04T10:16:19Z")

</div>

Closed on December 4, 2020, 10:16am UTC

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