InfluxDB 2 Downsampling for multiple timeframes

Hello everyone. I have one bucket (Historical Balances) that stores USD balances for our users. We have a CRON that runs every 15 minutes to submit new balances to the Historical Balances bucket. Schema looks like this:

Tags: wallet_id, currency (USD only right now)
Field: balance

I’d like to downsample the data from Historical Balances bucket into multiple buckets. On the client side, we have charts that show historical balances over time. 1 day, 1 week, 1 month, 3 month, 1 year, and All Time.

Am I on the right track with:

option task = { name: "1h Downsample", every: 1h0m0s }
fromBucket = "Historical Balances"
toBucket = "1h Historical Balances"

from(bucket: "Historical Balances")
    |> range(start: -task.every)
    |> filter(fn: (r) => r["_measurement"] == "Balance")
    |> aggregateWindow(fn: mean, every: task.every, createEmpty: false)
    |> to(bucket: toBucket)

Hello @Russell,
Yup! It looks good to me!
You might also find this useful: