PctGood
- Last UpdatedJan 11, 2023
- 1 minute read
- PI System
- PI Server 2024 R2
- PI Server
Find the time-weighted or event-weighted percentage, over a specified time range, for which the attribute had good values.
Syntax
PctGood(attname, starttime, endtime [, calculationBasis])
Arguments
-
attname
attribute with time series data (such as PI point data reference) enclosed in single quotes
-
starttime
time expression representing the beginning of a time range enclosed in single quotes; can be a relative time (such as'-3h') in reference to an absolute endtime
-
endtime
time expression representing the end of a time range enclosed in single quotes; can be a relative time (such as '+1h') in reference to an absolute starttime
-
calculationBasis
Optional. A string indicating the type of calculation to be performed enclosed in double quotes. Choose between "TimeWeighted" or "EventWeighted". If omitted, the default is time-weighted
Returns
An integer or real number from 0 to 100: time-weighted or event-weighted minimum time percentage during a specified time range for which the attribute had good values
Example
-
PctGood('att1', 't', '+1h')
[Return the time-weighted percentage between 12:00 and 1:00am today for which 'att1' had good values]
-
PctGood('att1', '-1h', '*')
[Return the time-weighted percentage between now and hour ago today for which 'att1' had good values]
-
PctGood('att1', '-1h', '*', "EventWeighted")
[Return the event-weighted percentage between now and hour ago today for which 'att1' had good values]