Hi all,
I have to do the opposite. I have a counter that represents the total consumption therefore always counts up. I want to get the consumption by time period.
When the time interval of the data is constant and there is no missing data then it’s simple with the difference() function.
unfortunately that’s not the case.
I set-up a demo on my home server with the problem.
http://81.83.6.53:3000
Problem discription as follow:
interval of logging total consumption counter is not fixed! Demo data is once a day in the morning, with 2 ‘error’. Missing data on 2018-05-04 Multiple data on 2018-05-10, even once with same consumption counter (no consumption)
with difference() function you see the spike at 2018-05-05 (which is consumption from 2 days, because of the missing data on 2018-05-04) and you see a very low (and even zero) consumption on 2018-05-10 because of the multiple data on that day.
I already tried different plugins like histogram, different functions like difference() and integral(). None with the desired result, consumption by time period.
Time period must be flexible. Here the data is daily, but it can also come in every 15 min.
To view daily from the 15 min data, I can use sum() To view on 15min base, from daily data, I want 96 times the same consumption (spreaded out). To view the demo data (daily) on 15min base, I want for every day around 96 values who are the same. except for 2018-05-10, because there the interval of data is more frequent. The term I found latest was BUCKETIZING or PRE-BUCKETED DATA
RAW data:
select * from consumption
name: consumption
time meter_id value
2018-05-01T09:37:56Z meter1 66
2018-05-02T10:18:44Z meter1 112
2018-05-03T08:07:13Z meter1 142
2018-05-05T09:17:25Z meter1 258
2018-05-06T08:03:01Z meter1 336
2018-05-07T08:01:13Z meter1 378
2018-05-08T08:34:12Z meter1 442
2018-05-09T08:44:08Z meter1 498
2018-05-10T07:25:08Z meter1 541
2018-05-10T07:35:28Z meter1 542
2018-05-10T07:55:28Z meter1 542
2018-05-10T07:59:55Z meter1 543
2018-05-10T08:01:55Z meter1 544
2018-05-11T08:23:21Z meter1 593
2018-05-12T09:01:21Z meter1 659
Thanks in advance! Regards, Maarten