Hi all,
I am working with flux for retrieving my energy consumption dataset and grouping data by calendar month :
I wrote this request :
from(bucket:"INFLUXDB-CLIENT/autogen")
|> filter(fn : (r) => r._measurement == "Compteur Gaz" and r.tag_name == "Compteur")
|> range(start : 2019-07-01T00:00:00-00:00)
|> window(every : 1mo)
|> increase()
|> last()
But as a result I expected one single result and I get 3 results :
Why it doesn’t show only a value for the period 01/07/19 to 24/07/19 ?
Hello @Elisa_Scheer,
Thank you for your question. I’m having some trouble with window() right now as well. I need to ask someone, and I’ll get back to you. In the meantime, have you tired using aggregateWindow()?
Hi,
Thanks for your reply, I tested aggregateWindow() :
from(bucket:"INFLUXDB-CLIENT/autogen")
|> filter(fn : (r) => r._measurement == "Compteur Gaz" and r.tag_name == "Compteur")
|> range(start : 2019-06-01T00:00:00-00:00)
|> aggregateWindow(every : 1mo, fn : mean)
and this is the result :
and with the function window() :
from(bucket:"INFLUXDB-CLIENT/autogen")
|> filter(fn : (r) => r._measurement == "Compteur Gaz" and r.tag_name == "Compteur") |> range(start : 2019-06-01T00:00:00-00:00)
|> window(every : 1mo)
|> mean()
and here is the result :
I don’t understand why data are grouping from 2019-06-13 to 2019-07-11 and from 2019-07-11 to 2019-07-25 and not from 2019-06-13 to 2019-06-30 and from 2019-07-01 to 2019-07-25
Do you think it is because of the version of influxDB or something else?
Best regards
That is odd, I don’t understand it either. What do you get for
|> range(start: dashboardTime)
|> filter(fn: (r) => r._field == "usage_system")
|> filter(fn: (r) => r.cpu == "cpu-total")
|> aggregateWindow(every: 1mo, fn: mean)
?
where dashboardTime is 06/01?
@Elisa_Scheer,
What version of Influxdb are you using?