Skip to main content
PI System
PI AFSDK
Data Quality

Understanding the PI System 'pctgood' Function: How Is It Calculated?

Learn how the 'pctgood' function in PI System calculates the percentage of good data over a specified time period, and how it handles periods with missing or bad data.

Roshan Soni

4 min read

Understanding the PI System 'pctgood' Function: How Is It Calculated?

The OSIsoft PI System offers a powerful suite of analytical tools to assess data quality and availability. Among these, the pctgood function is frequently used—but often misunderstood. In this post, we'll unpack how pctgood is calculated and what it tells you about your PI Points, particularly when you have partial or intermittent data coverage.

What Does pctgood Measure?

The pctgood (percent good) function computes the percentage of time within a given time range that a PI Point records 'good' data. This metric is crucial for understanding not just data value accuracy, but the reliability and coverage of your data acquisition process.

Key Concepts: Good, Bad, and Missing Data

To understand pctgood, it's helpful to differentiate between:

  • Good Data: Data values with a 'good' status (valid readings, as per PI definitions).
  • Bad Data: Values marked explicitly as 'bad'—for instance, statuses like I/O Timeout, Error, Comm Fail, etc.
  • No Data: Intervals where no data is stored or reported at all—for example, if the PI Interface was down and no samples were recorded.

How Does pctgood Handle Missing Data?

A common point of confusion is how pctgood treats time periods where there is no data at all. Let's clarify with an example:

Scenario: You have a PI Point 'A' that collected data only from 01:00 to 13:00 on June 26th (12 hours), and was silent for the remaining 12 hours.

Question: If you calculate pctgood('A', '26-Jun-2012 00:00:00', '27-Jun-2012 00:00:00'), will it return 100% or 50%?

The Answer: pctgood Considers Time with No Data as 'Not Good'

pctgood calculates its percentage based on the entire time window you specify. If there is no data for part of the period, that time is not counted as 'good'—unless the point is marked as "stepped", in which case the last known value might be extended. For most continuous analog points:

  • All values during the 12-hour stretch are good
  • No values for the other 12 hours
  • pctgood = (12 hours with good data) / (24 hour time range) = 50%

You will only see pctgood as 100% if there is good data throughout the entire range.

Bad statuses (e.g., No Data, Error) are explicitly counted as 'not good,' reducing the percentage further. Time periods with no recorded data—without a good status—are also not counted towards 'good' time.

References and Further Learning

Conclusion

Understanding the nuances of pctgood is essential to monitoring data quality in your PI System. Remember, it's not just about the absence of errors or explicit bad statuses—any gap in data is reflected in the percentage. Use this knowledge to better design your instrumentation strategy and to more accurately interpret the health of your data streams.

Tags

#OSIsoft PI
#Data Quality
#PI Point
#pctgood
#data calculation
#time-weighted data
#how-to

About Roshan Soni

Expert in PI System implementation, industrial automation, and data management. Passionate about helping organizations maximize the value of their process data through innovative solutions and best practices.

Sign in to comment

Join the conversation by signing in to your account.

Comments (0)

No comments yet

Be the first to share your thoughts on this article.

Related Articles

Enhancing PI ProcessBook Trends with Banding and Zones: User Needs, Workarounds, and the Road Ahead

A look at the user demand for trend banding/zoning in OSIsoft PI ProcessBook, current VBA workarounds, UI challenges, and how future PI Vision releases aim to address these visualization needs.

Roshan Soni

Migrating PIAdvCalcFilVal Uptime Calculations from PI DataLink to PI OLEDB

Learn how to translate PI DataLink's PIAdvCalcFilVal advanced calculations—like counting uptime based on conditions—into efficient PI OLEDB SQL queries. Explore three practical approaches using PIAVG, PIINTERP, and PICOunt tables, and get tips for validation and accuracy.

Roshan Soni

Understanding PI Web API WebID Encoding: Can You Generate WebIDs Client-Side?

Curious about how PI Web API generates WebIDs and whether you can encode them client-side using GUIDs or paths? This article explores the encoding mechanisms, current documentation, and best practices for handling WebIDs in your applications.

Roshan Soni