Last measurement result greater than 0 per day

Hello all,

I’m going crazy with the Influx. :slight_smile:

I get a Daily_Energy_Yield value from a SmartMeter. I want to retrieve this value per day, but always the last value greater than 0.

from(bucket: "my-bucket")
  |> range(start: -10d, stop: now())
  |> filter(fn: (r) => r["_measurement"] == "0_userdata.0.Huawei.Inverter.Daily_Energy_Yield")
  |> filter(fn: (r) => r["_field"] == "value")
  |> aggregateWindow(every: 1d, fn: last, createEmpty: false)
  |> yield(name: "last")

This is my raw data.

Finally, I would like to display it like this.

Thanks for help

… just filter value bigger than zero
another tip, if you use relative time as start, you dont need to type now() it is implicit that is relative to now

Thank you for the answer,

I’ve adopted it as it is.
But I only get 2 values from last month and one that is current from today.