# Calculate and store result

**URL:** <https://community.influxdata.com/t/calculate-and-store-result/13644>\
**Category:** Welcome & Getting Started\
**Created:** [March 27, 2020, 3:02pm UTC](https://community.influxdata.com/t/calculate-and-store-result/13644 "2020-03-27T15:02:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmorisod](https://avatars.discourse-cdn.com/v4/letter/n/bcef8e/32.png) [@nmorisod](https://community.influxdata.com/u/nmorisod)\
**Post date:** [March 27, 2020, 3:02pm UTC](https://community.influxdata.com/t/calculate-and-store-result/13644/1 "2020-03-27T15:02:40Z")

</div>

Hi,

I might ask for some newbies question beause i’m quite new to influxDB but trying to understand few thing.

I made a TIG stack which i use for a specific project, some kind of counter.  
I got some devices sending to telegraf counter data (number between -10 to 20) every 5 sec or so, which is stored in InfluxDB.  
I use Grafana to vizualize these data which consist of a graph over time with the sum of all these tick data for 24 hours.

It works fine but i don’t think it’s very efficient because the grafana vizualisation use a query that will sum all these data.

example : SELECT cumulative\_sum(sum(“counterdata”)) FROM measurement.field WHERE bla bla bla AND time \>= now() - 24h GROUP BY time($\_\_interval)  
So if i’m right every time the visualization refresh it will look at all data and do a calulation again (sum) of these and graf over time.

What i would like is create another table which contain already calculated data like 1 record ever 5 or 10 sec so there is not need to calculate anything when querying for vizualisation.  
How influxDB can query, calculate and store every xxx sec automaticaly ?

I checked how to do that and wondering if continous queries or anything else would be more appropriated to do that (Flux maybe)

What do you think ?

Sorry for my bad english.

regards,

Nicolas
