# Canvas, essql average per minute

**URL:** <https://discuss.elastic.co/t/canvas-essql-average-per-minute/256900>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [November 27, 2020, 3:53pm UTC](https://discuss.elastic.co/t/canvas-essql-average-per-minute/256900 "2020-11-27T15:53:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElasticLiver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticliver/32/64869_2.png) [@ElasticLiver](https://discuss.elastic.co/u/ElasticLiver)\
**Post date:** [November 27, 2020, 3:53pm UTC](https://discuss.elastic.co/t/canvas-essql-average-per-minute/256900/1 "2020-11-27T15:53:59Z")

</div>

Hi, how can I get the average count per minute in ESSQL?

I have tried surrounding the COUNT() with AVG() but doesnt work, this Is my query:

```auto
SELECT COUNT(*) as count_documents FROM "my-index*" WHERE
transaction.result IS NOT NULL AND service.name = 'my-service'

```

---

<div class="post-metadata">

**Author:** ![clintandrewhall](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/clintandrewhall/32/45435_2.png) [@clintandrewhall](https://discuss.elastic.co/u/clintandrewhall)\
**Post date:** [November 27, 2020, 4:59pm UTC](https://discuss.elastic.co/t/canvas-essql-average-per-minute/256900/2 "2020-11-27T16:59:32Z")

</div>

First, I would debug the results of your expression to ensure the `COUNT(*)` portion of the query matches what you're expecting, before applying the `AVG()`. Details on debugging elements can be found in this blog post:

> **[Using Data Table and Debug Elements in Canvas within Kibana](https://www.elastic.co/blog/kibana-canvas-data-table-and-debug-elements)**
>
> Learn how to work with the Data Table and Debug elements in Canvas, using a sample data set built-into Elasticsearch and Kibana.

I would imagine `COUNT(*)` is returning you a single number-- the count of results-- rather than a collection of counts to average.

---

<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 25, 2020, 4:59pm UTC](https://discuss.elastic.co/t/canvas-essql-average-per-minute/256900/3 "2020-12-25T16:59:49Z")

</div>

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