# How to plot over time the sum of iot values using last value rather than the cumulative sum

**URL:** <https://discuss.elastic.co/t/how-to-plot-over-time-the-sum-of-iot-values-using-last-value-rather-than-the-cumulative-sum/353286>\
**Category:** Kibana\
**Created:** [February 14, 2024, 1:43pm UTC](https://discuss.elastic.co/t/how-to-plot-over-time-the-sum-of-iot-values-using-last-value-rather-than-the-cumulative-sum/353286 "2024-02-14T13:43:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien\_Revol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julien_revol/32/106083_2.png) [@Julien\_Revol](https://discuss.elastic.co/u/Julien_Revol)\
**Post date:** [February 14, 2024, 1:43pm UTC](https://discuss.elastic.co/t/how-to-plot-over-time-the-sum-of-iot-values-using-last-value-rather-than-the-cumulative-sum/353286/1 "2024-02-14T13:43:34Z")

</div>

I have a simple CSV sample like that and i want to see the evolution of the sum, breaked down by de last value

```auto
date	evse	power
2024-02-12T10:00:00	evse_1	2
2024-02-12T11:00:00	evse_1	4
2024-02-12T12:00:00	evse_1	6
2024-02-12T13:00:00	evse_1	8
2024-02-12T14:00:00	evse_1	10
2024-02-12T15:00:00	evse_1	12
2024-02-12T10:00:00	evse_2	2
2024-02-12T11:00:00	evse_2	10
2024-02-12T15:00:00	evse_2	4
2024-02-12T10:00:00	evse_3	2
2024-02-12T13:00:00	evse_3	8
2024-02-12T15:00:00	evse_3	12
2024-02-12T10:00:00	evse_4	1
2024-02-12T11:00:00	evse_4	2
2024-02-12T12:00:00	evse_4	3
2024-02-12T13:00:00	evse_4	4
2024-02-12T14:00:00	evse_4	5
2024-02-12T15:00:00	evse_4	6
2024-02-12T10:00:00	evse_5	2
2024-02-12T11:00:00	evse_5	10

```

in this example i have 5 IOT elements that send power level at some time, i want to plot the sum of all the power over time using the last value received from the iot element as the value until a new one comes in

I don't understand how to do that with kibana

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [February 15, 2024, 4:01pm UTC](https://discuss.elastic.co/t/how-to-plot-over-time-the-sum-of-iot-values-using-last-value-rather-than-the-cumulative-sum/353286/2 "2024-02-15T16:01:36Z")

</div>

Hi @Julien_Revol. I think you might need to [create a transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/transforms.html) that writes the last value to a separate index. Then you could aggregate over the metrics using the new index.

Maybe similar to [this example](https://www.elastic.co/guide/en/elasticsearch/reference/current/transform-examples.html#example-last-log).

---

<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 14, 2024, 4:02pm UTC](https://discuss.elastic.co/t/how-to-plot-over-time-the-sum-of-iot-values-using-last-value-rather-than-the-cumulative-sum/353286/3 "2024-03-14T16:02:24Z")

</div>

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