Fill the previous value if there is no value

I am using telegraf to retrieve the data with the following subscription_mode = “on_change”
Thereby I can have no data for several hours.
I am using the following flux request and I would like to use : fill(usePrevious: true) because I feel that it will use the latest value.

Any help will be welcome

from(bucket: “interfaces”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == “ifcounters”)
|> filter(fn: (r) => r["_field"] == “in_octets”)
|> filter(fn: (r) => r[“device”] == “”)
|> filter(fn: (r) => r[“name”] == “Management1”)
|> derivative(unit: 1s, nonNegative: true)
|> yield(name: “nonnegative derivative”)

Hello @fdelmotte,
you can use the fill() function

What’s not meeting your expectations with it?

Thank you for your answer, I saw this function but I was not able to use it with the script below. Can you complete my example?