# Last and sum in Kibana ESSQL

**URL:** <https://discuss.elastic.co/t/last-and-sum-in-kibana-essql/277036>\
**Category:** Kibana\
**Created:** [June 25, 2021, 9:17am UTC](https://discuss.elastic.co/t/last-and-sum-in-kibana-essql/277036 "2021-06-25T09:17:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xquest](https://avatars.discourse-cdn.com/v4/letter/x/ce73a5/32.png) [@xquest](https://discuss.elastic.co/u/xquest)\
**Post date:** [June 25, 2021, 9:17am UTC](https://discuss.elastic.co/t/last-and-sum-in-kibana-essql/277036/1 "2021-06-25T09:17:52Z")

</div>

Hi!  
I am using Kiban canvas and sometimes Kibana canvas expression editor.

I got some search:

```auto
SELECT host.name as n, system.diskio.name as s,
last(system.diskio.io.time,"@timestamp") as v
FROM "<metricbeat-7.11.1-{now/d}>"
where n is not null and s is not null
group by n, s
order by v desc

```

and in result I got:

```auto

serv1 sda 120
serv1 sdg 400
serv1 spf 300
serv5 sda 200

```

How to modify this search to sum this value, but only last value sum(last) doesn't work.

I want to get result like:

```auto
serv1 820
serv5 200

```

Is it possible in Kibana sql or Kibana essql?

---

<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:** [July 23, 2021, 9:18am UTC](https://discuss.elastic.co/t/last-and-sum-in-kibana-essql/277036/2 "2021-07-23T09:18:17Z")

</div>

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