Continuous query to get monthly energy consumption

Hi,

I am new to InfluxDB and I am struggling with visualising energy consumption per month. I read that InfluxDB doesn’t support group by time(month) so I am trying to test another solution to get my consumption per month.

For now, I am doing this with group by time(30d) but it just returned dataset from 30days until now (which is normal). So it is not regular value…

So I read about writing a continuous query in order to retrieve each monthly consumption from counters in another table.

But I don’t know what is the correct request that I have to implement.
For example if I want all data from June, I can write :

SELECT max("value") - min("value") FROM "counters_table" WHERE ("machine" = 'counter1' AND "tag_name" = 'Index' AND time >= '2019-06-01' and time <= '2019-06-31') 

But if I want to have a continous query that can exec this command for each month, I don’t know how to replace the WHERE time condition

Do you have any idea ?

Best regards

@Elisa_Scheer Are you trying to dump this data into another measurement (another table?)

Yes I want to write it to another table data_month, I read it is possible with continuous query so that I will be able to compute monthly consumption in another table and will solve my issue with the group by time(30d)

@Elisa_Scheer Check out this: Dump converted data to a new measurement?

I posted this about a month ago. It seems similar to the problem you are trying to solve.