Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AggregateWindow example: calculate gain per window (hourly daily monthly) #5284

Open
neonarc4 opened this issue Dec 26, 2023 · 3 comments
Open
Labels
Flux InfluxDB v3 InfluxDB v3.0 (platforms using IOx)

Comments

@neonarc4
Copy link

neonarc4 commented Dec 26, 2023

from(bucket: "Neo")
  |> range(start: -1h)
  |> filter(fn: (r) => r["_measurement"] == "async_m")
  |> filter(fn: (r) => r["_field"] == "current")
  |> filter(fn: (r) => r["location"] == "raza")
  |> aggregateWindow(every: 1h, fn: sum)
  |> spread()
  |> yield(name: "sum")

calculate hourly total gain of daily and monthly and total
const data = total ,gain
hourly - data
daily - data
monthly - data
total - data

@neonarc4 neonarc4 changed the title hourly base giving 2 output bug hourly base giving neagtive output bug Dec 26, 2023
@neonarc4 neonarc4 changed the title hourly base giving neagtive output bug need help to understand hourly daily monthly Dec 26, 2023
@jstirnaman jstirnaman added Flux InfluxDB v3 InfluxDB v3.0 (platforms using IOx) labels Dec 27, 2023
@jstirnaman
Copy link
Contributor

This might be a good example to include for all products

@jstirnaman jstirnaman changed the title need help to understand hourly daily monthly AggregateWindow example: calculate gain per window (hourly daily monthly) Dec 27, 2023
@jstirnaman
Copy link
Contributor

jstirnaman commented Dec 29, 2023 via email

@neonarc4
Copy link
Author

got the answer thnx man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Flux InfluxDB v3 InfluxDB v3.0 (platforms using IOx)
Projects
None yet
Development

No branches or pull requests

2 participants