Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

PI Powershell

GetPIExpressionSummary Class

  • Last UpdatedDec 15, 2025
  • 4 minute read
GetPIExpressionSummary Class

Get summary calculation for the specified expression

The Get-PIExpressionSummary cmdlet gets a summary calculation based on the passed in expression. The connection parameter specifies which connection to a PI Data Archive to use.

Inheritance Hierarchy

SystemObject
  InternalCommand
    Cmdlet
      PSCmdlet
        OSIsoft.PowerShellOSICmdletBase
          OSIsoft.PowerShellOSICmdletBaseWithConnection
            OSIsoft.PowerShellGetPIExpressionSummary

Namespace:  OSIsoft.PowerShell
Assembly:  OSIsoft.PowerShell (in OSIsoft.PowerShell.dll) Version: 3.1.1.0 (3.1.1.466)

Syntax

[CmdletAttribute("Get", "PIExpressionSummary", SupportsShouldProcess = true, 
	DefaultParameterSetName = "WithoutSampleTimes")]
public class GetPIExpressionSummary : OSICmdletBaseWithConnection
<CmdletAttribute("Get", "PIExpressionSummary", SupportsShouldProcess := true, 
	DefaultParameterSetName := "WithoutSampleTimes")>
Public Class GetPIExpressionSummary
	Inherits OSICmdletBaseWithConnection

Dim instance As GetPIExpressionSummary
[CmdletAttribute(L"Get", L"PIExpressionSummary", SupportsShouldProcess = true, 
	DefaultParameterSetName = L"WithoutSampleTimes")]
public ref class GetPIExpressionSummary : public OSICmdletBaseWithConnection
[<CmdletAttribute("Get", "PIExpressionSummary", SupportsShouldProcess = true, 
	DefaultParameterSetName = "WithoutSampleTimes")>]
type GetPIExpressionSummary =  
    class
        inherit OSICmdletBaseWithConnection
    end

The GetPIExpressionSummary type exposes the following members.

Constructors

  NameDescription
Public method
GetPIExpressionSummary

Properties

  NameDescription
Public property
Basis

Specifies the method of evaluating the events.

Public property
Connection

Specifies which connection to a PI Data Archive to use.

(Overrides OSICmdletBaseWithConnectionConnection.)
Public property
Expression

PI Performance equation expression to evaluate

Public property
Intervals

Number of evenly spaced intervals in each time range. This array has to be one element shorter than Times.

Public property
Reverse

Return values in reverse order

Public property
SampleIntervals

Number of evenly spaced intervals in each sampling time range. This array has to be one element shorter than SampleTimes.

Public property
SampleTimes

Timestamps to sample

Public property
SummaryType

Specifies the kind(s) of summaries to make. Any combination of summaries is valid. To make your own combination, use: [OSIsoft.PI.Net.SummariesType] "option1, option2, ..., optionN"

Public property
Times

The time ranges. If the whole range is evenly spaced, this argument has only two elements, the starttime and endtime.

Examples

$results = Get-PIExpressionSummary -Times $times -Intervals 28 -SummaryType Average -Basis TimeWeighted -Expression "'Sinusoid'" -Connection $con

Where:

$times = @("1-Feb-2017","1-Mar-2017")

This example will calculate daily, timeweighted averages for the month of February for the expression 'Sinusoid'. The StartTime of the query is the first element in the $times array and the EndTime is the second element in the $times array. The -Intervals is the number of equal segments you want to split the time range into, in this case 28. Since there are 28 days from 1-Feb to 1-Mar, this becomes a daily average.

The $results are returned as an array of summaries and can be consumed in a number of ways. The simplest being:

$results[i].StartTime to extract the summary starttimes

$results[i].EndTime to extract the summary endtimes

$results[i].Values to extract the summary values

$results[i].Values['Average'].PercentGood to extract the summary value percent good

Examples

$results = Get-PIExpressionSummary -Times $times -Intervals $intervals -SummaryType Average -Basis TimeWeighted -Expression "'Sinusoid'+'CDT158'" -Connection $con

Where:

$times = @("1-Jan-2017","1-Feb-2017","1-Mar-2017")

$intervals = @(31,28)

This example will return the daily time-weighted average of the sum of two tags, sinusoid and cdt158, for each day in January and February of 2017.

In this case we are querying over two separate intervals, the first from 1-Jan-2017 to 1-Feb-2017 with 31 intervals (31 days) and the second being from 1-Feb-2017 to 1-Mar-2017 with 28 intervals (28 days). So, the first element of $intervals applies to the first and second element of $times, the second element of $intervals applies to the second and third elements of $times, etc. So, $intervals must have 1 less element than $times.

Note that -Times takes an array of timestamps, -Intervals takes either a single integer value or an array of integer values, and -Expression takes a valid PI Performance Equation expression. The results of this cmdlet ($results) is an array of summaries. See the previous example for an example of how to extract data from the results.

See Also

TitleResults for “How to create a CRG?”Also Available in