to bring more clarity in this topic i have made a sample data set, 12 records one for each month with a difference counter from 1 per record, starting by 10:
power_consumption,host=fhem,month=0,year=123 value=10.0 1672610400150183134
power_consumption,host=fhem,month=1,year=123 value=11.0 1675413900169791501
power_consumption,host=fhem,month=2,year=123 value=12.0 1677903300133465637
power_consumption,host=fhem,month=3,year=123 value=13.0 1681324200156906309
power_consumption,host=fhem,month=4,year=123 value=14.0 1683888300166902729
power_consumption,host=fhem,month=5,year=123 value=15.0 1686492900168486777
power_consumption,host=fhem,month=6,year=123 value=16.0 1689223500162810796
power_consumption,host=fhem,month=7,year=123 value=17.0 1690945200177528171
power_consumption,host=fhem,month=8,year=123 value=18.0 1694354400173095563
power_consumption,host=fhem,month=9,year=123 value=19.0 1697125500163008242
power_consumption,host=fhem,month=10,year=123 value=20.0 1700164800157812443
power_consumption,host=fhem,month=11,year=123 value=21.0 1703358000164680983
first step:
after loading the data in influxdbcloud i made an query with flux, the query looks like as follows (without difference() function) , the range is over the whole year 2023:
second step:
(grafanacloud flux statement)
import “timezone” option location = timezone.location(name: “Europe/Berlin”)
from(bucket: “${BucketInflux}”)
|> range(start: ${__from:date}, stop: ${__to:date})
|> drop(columns: [“host”, “year”, “month”])
the result is correct and looks like as follows
third step:
as last step im using the query with difference(), the range is over the whole year 2023:
import “timezone” option location = timezone.location(name: “Europe/Berlin”)
from(bucket: “${BucketInflux}”)
|> range(start: ${__from:date}, stop: ${__to:date})
|> drop(columns: [“host”, “year”, “month”])
|> difference()
the result is not correct and looks as follows:
have anybody an idea wy flux ist calculation for march -9 and for november 9 ?