How can I add previous results in a line chart to new results

Hello. For example, I have a graph that shows the number of products added to the supermarket. I added 20 products in the first hour, 5 products in the second hour and 8 products in the third hour. I want to combine each point with the results of the previous points. First point must be 20 (for the first hour), second point must be 20 + 5 = 25 (for the second hour) and third point must be 20 + 5 + 8 = 32 (for the third hour). How can I do this?

Thanks.

Hi @111249,

I think for this you can use timelion with the following expression: .es(index={INDEX_PATTERN}, timefield=date, metric=cardinality:{METRIC_NAME}).cusum()

Cheers

Thank you for answer @tiagocosta . I made this expression: .es(split=supermarket:7, timefield=lastScraped, index=test*). End I got this result: https://prnt.sc/qqmxhr

I don't know what I need to use as {METRIC_NAME}, because I want make sum of the count by time. I need get something like this: https://prnt.sc/qqn2zt
How I can do this?

@111249 could u try to add .cusum() at the end of your current expression?

Thank you so much, it helped