GetPIExpressionSummary Class
- Last UpdatedDec 15, 2025
- 4 minute read
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
InternalCommand
Cmdlet
PSCmdlet
OSIsoft.PowerShellOSICmdletBase
OSIsoft.PowerShellGetPIExpressionSummary
Namespace: OSIsoft.PowerShell
Assembly: OSIsoft.PowerShell (in OSIsoft.PowerShell.dll) Version: 2.2.3.0 (2.2.3.952)
Syntax
[CmdletAttribute("Get", "PIExpressionSummary", SupportsShouldProcess = true, DefaultParameterSetName = "WithoutSampleTimes")] public class GetPIExpressionSummary : OSICmdletBase
<CmdletAttribute("Get", "PIExpressionSummary", SupportsShouldProcess := true, DefaultParameterSetName := "WithoutSampleTimes")> Public Class GetPIExpressionSummary Inherits OSICmdletBase Dim instance As GetPIExpressionSummary
[CmdletAttribute(L"Get", L"PIExpressionSummary", SupportsShouldProcess = true, DefaultParameterSetName = L"WithoutSampleTimes")] public ref class GetPIExpressionSummary : public OSICmdletBase
[<CmdletAttribute("Get", "PIExpressionSummary", SupportsShouldProcess = true, DefaultParameterSetName = "WithoutSampleTimes")>] type GetPIExpressionSummary = class inherit OSICmdletBase end
The GetPIExpressionSummary type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| GetPIExpressionSummary |
Properties
| Name | Description | |
|---|---|---|
| Basis | Specifies the method of evaluating the events. | |
| Connection | Specifies which connection to a PI Data Archive to use. | |
| Expression | PI Performance equation expression to evaluate | |
| Intervals | Number of evenly spaced intervals in each time range. This array has to be one element shorter than Times. | |
| Reverse | Return values in reverse order | |
| SampleIntervals | Number of evenly spaced intervals in each sampling time range. This array has to be one element shorter than SampleTimes. | |
| SampleTimes | Timestamps to sample | |
| 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" | |
| 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 eegments 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 a hashtable and can be consumed in a number of ways. The simplest being:
$results.Value.Values[0] to extract the summary starttimes
$results.Value.Values[1] to extract the summary endtimes
$results.Value.Values[2] to extract the summary values
$results.Value.Values[3] to extract the summary percent good of the summary queries
Examples
$results = Get-PIExpressionSummary -Times $times -Intervals $intervals -SummaryType Average -Basis TimeWeighted -Expression "'Sinusoid'+'CDT158'" -Connection $conWhere:
$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 a hash table. See the previous example for an example of how to extract data from the results hash table.