dateTime of latestValue?

#1

Is there a way to get the Datetime corresponding to the latest value in a normalized timeSeries?

0 Likes

#2

See ExpressionEngineFunction.latest

0 Likes

#3

The simplest approach is to look at the latest field on the time series header. The latest field will provide the datetime of the latest normalized data point.

0 Likes

#4

I am trying to write a metric that will return the dateTime of the latestValue, not the latestValue itself.
Is there a way to use the ExpressionEngineFunction to extract the dateTime from the LatestValue?

0 Likes

#5

Use latest (e.g latest(normalized.data.quantity)) to get an identity timeseries of datetime values (corresponding to datetime of latest value).
Use latestValue (e.g. latestValue(normalized.data.quantity)) to get an identity timeseries of double values (corresponding to latest value).

1 Like

#6

Yes, that’s what ExpressionEngineFunction.latest does.
From the docs:

Returns Timeseries — the timeseries of the last available point (end)
for which the TS has data (independent of query range).
1 Like