I have an increasing time-series data and I would like to get the difference 
between two consecutive measurements. I am using the difference() function, but 
I get erroneous negative output and irregular time order in the output.

Check the following two queries:

> SELECT "view_count" FROM daily_graph_stats WHERE time >= '2016-09-01'
name: daily_graph_stats
time                 view_count
----                 ----------
2016-09-01T04:00:00Z 462
2016-09-02T04:00:00Z 464
2016-09-03T04:00:00Z 464
2016-09-04T04:00:00Z 466
2016-09-05T04:00:00Z 467
2016-09-06T04:00:00Z 468
2016-09-07T04:00:00Z 468
2016-09-08T04:00:00Z 468
2016-09-09T04:00:00Z 470
2016-09-10T04:00:00Z 472
2016-09-11T04:00:00Z 474
2016-09-12T04:00:00Z 474
2016-09-13T04:00:00Z 475
2016-09-14T04:00:00Z 480
2016-09-15T04:00:00Z 483
2016-09-16T04:00:00Z 485
2016-09-19T04:00:00Z 491
2016-09-20T04:00:00Z 493
2016-09-21T04:00:00Z 496
2016-09-22T04:00:00Z 498
2016-09-23T04:00:00Z 498


> SELECT difference("view_count") FROM daily_graph_stats WHERE time >= 
> '2016-09-01'
name: daily_graph_stats
time                 difference
----                 ----------
2016-09-02T04:00:00Z 2
2016-09-03T04:00:00Z 0
2016-09-04T04:00:00Z 2
2017-02-06T05:00:00Z 918
2017-02-07T05:00:00Z 22
2017-02-08T05:00:00Z 15
2017-02-09T05:00:00Z 38
2017-02-10T05:00:00Z 13
2017-02-11T05:00:00Z 8
2017-01-30T05:00:00Z -225
2017-01-31T05:00:00Z 22
2017-02-01T05:00:00Z 26
2017-02-02T05:00:00Z 27
2017-02-03T05:00:00Z 35
2017-02-04T05:00:00Z 8
2017-02-05T05:00:00Z 7
2017-01-23T05:00:00Z -214
2017-01-24T05:00:00Z 15
2017-01-25T05:00:00Z 15
2017-01-26T05:00:00Z 10
2017-01-27T05:00:00Z 10
2017-01-28T05:00:00Z 15
2017-01-29T05:00:00Z 7
2017-01-16T05:00:00Z -195
2017-01-17T05:00:00Z 4
2017-01-18T05:00:00Z 30
2017-01-19T05:00:00Z 31


The first query returns as expected, but the second (difference) query output 
is not what I expect to see.

Is there something I am missing? Your help is appreciated.

Ubuntu 14.04 InfluxDB v1.2

Regards,
Ahmet Kizilay

-- 
Remember to include the version number!
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to influxdb+unsubscr...@googlegroups.com.
To post to this group, send email to influxdb@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/0fffedf4-0687-4862-84a9-3a88260ea8de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to