Without interpolation, the following looks quite good as it does not introduce those small errors:
from(bucket: "default")
|> range(start: 2024-04-01T00:00:00Z, stop: 2024-04-03T23:59:59Z)
|> filter(fn: (r) => r["_measurement"] == "Measurement")
|> aggregateWindow(every: 1d, fn: max)
will output
2024-04-01T00:00:00Z: 10
2024-04-02T00:00:00Z: 39
Taken from: Flux: Get total energy by month with an ever-increasing value - #8 by grant1