PREV/PREVGOOD
- Last UpdatedMar 20, 2025
- 1 minute read
The PREV() and PREVGOOD() functions return the last value from the previous time period for the provided stream.
When using PREV() or PREVGOOD() in a query, if no resolution is specified then the query returns an error.
Syntax
|
Format |
Stream = PREV(Stream, TimeInterval) |
|
Arguments |
Stream - A time-ordered vector of values TimeInterval - The time period for which to return the last value |
|
Description |
Returns the last value from the previous time period, where the period is specified by TimeInterval. |
|
Format |
Stream = PREVGOOD(Stream, TimeInterval) |
|
Arguments |
Stream - A time-ordered vector of values TimeInterval - The time period for which to return the last value |
|
Description |
Returns similar results to PREV(), but values with "bad" or "uncertain" quality are skipped. PREVGOOD will continue seeking backwards until a "good" value is found, going beyond the previous period if necessary. This means PREVGOOD always returns a value with "good" quality. |