docs-v2 icon indicating copy to clipboard operation
docs-v2 copied to clipboard

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

Open neonarc4 opened this issue 1 year ago • 3 comments

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 avatar Dec 26 '23 15:12 neonarc4

This might be a good example to include for all products

jstirnaman avatar Dec 27 '23 21:12 jstirnaman

Hi, I recommend posting your questions to the InfluxDB Community on Slack: https://join.slack.com/t/influxcommunity/shared_invite/zt-2a0yuh9pc-fJqrDaBoSqWzHgYnZhofIg

On Fri, Dec 29, 2023, 3:24 AM neonarc4 @.***> wrote:

@jstirnaman https://github.com/jstirnaman can u give me any hint how it possible on influxdb2 right now recently few month started influxdb i want to learn first before buying v3 hosting

i wonder this calculation cost so much load on influxd if i set an interval 5sec i need to fetch previous next month then i need to subtract is their an efficient way of doing it like single query bring gain and loss

— Reply to this email directly, view it on GitHub https://github.com/influxdata/docs-v2/issues/5284#issuecomment-1871870803, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABT2A27JB6GYG63SP3LMWDYL2D6XAVCNFSM6AAAAABBDLSDW6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRHA3TAOBQGM . You are receiving this because you were mentioned.Message ID: @.***>

jstirnaman avatar Dec 29 '23 13:12 jstirnaman

got the answer thnx man

neonarc4 avatar Dec 31 '23 18:12 neonarc4