influxdata / influxdata/docs-v2

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

Open
#5,284 3 comments 0 reactions 0 assignees View on GitHub
Flux InfluxDB v3 product:flux
Dominant language
JavaScript
Stars
82
Forks
326
Avg merge
1d 1h
Merged PRs (30d)
82

Description

```
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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by clarifying the intended hourly, daily, monthly, and overall gain calculations in the provided Flux query using aggregateWindow and spread(). Then identify the appropriate documentation page for this example and define the expected output for each time window before drafting or testing the example.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.