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