Is it possible to get hourly averages over a period of time with Flux?

I stored instantaneous power usage of my home in an influxdb time series and I would like to get the hourly average over a chosen period of time.

In other words input data ranging a month, and output data a table with 24 rows, one value per row.

Basically I want my average daily power usage curve.

Someone else asked the same almost two years ago: Average per hour - #8 by pau_l
It was not possible.

Can I do it with Flux now, which was not available back then?

Which syntax should I use? I have zero experience with Flux.

I posted a possible solution here

@dewi-ny-je This is what the aggregateWindow() function is designed for:

The following example will give you your average power usage per hour over the last 30days. Just replace your-bucket-name, your-measurement-name, and your-field-name with the appropriate values to match your schema.

from(bucket: "your-bucket-name")
  |> range(start: -30d)
  |> filter(fn: (r) => r._measurement == "your-measurement-name" and f._field == "your-field-name") 
  |> aggregateWindow(every: 1h, fn: mean)

Since google pointed me here…
This post: Average per hour - #14 by MarioG shows how to do this.
One thing i would change is to use integral instead of mean in the aggregate window