[SOLVED] Sample data at specified time

I need to create a synthetic variable by sampling a data set at midnight every day.
I then need to create the average of the last 6 readings at midnight.
I have used:
last(volts, “1D”)
However the last value in the series is the current value.
i.e. the reading at midnight last night was 4.0. The current reading at 21:30 is 3.87
When I use last(volts, “1D”) I get [. . ., 4.0, 3.87]
I should get [… , 4.0]
How do I eliminate the current value from the time series?
If I use:
last(volts, “1H”)
then the last value is at the end of the last hour, not the current value

Hi there, when you set a time span in your synthetic expression you will always get a result that includes the actual raw variable value, this means, that if you set last(volts, "1D") the span will compute the value of the last days and the last value of the actual day because it is part of the time series to retrieve.

If you need to avoid the actual value, the best way to do that is using ubifunctions, with them you may manage the time series values in a more flexible way.

Let me know if you have any additional question.