Hi Eamonn,
Welcome to the forum.
Try the following:
- Create a PI Calculation and set the expression to be your PI tag.
- Set the interval to be "1d".
- Set the sync time to be 00:00:00 (unless you want to average from a different time, e.g. start of shift).
- Make sure "Stepped" is selected.
- Add a Trend to your display.
- Set the trend end time to *-7day.
- Add your PI tag as a trace.
- Add you PI calculation as a trace but select the "Average" column.
You will see your daily averages over the period of 1 week. Hope this is what you required.
Then if you want to manipulate the average period and trend time range then you would use VBA to manipulate the dataset. e.g. for the average interval, just change the dataset interval (example, 1d to 1h) and to change the trend then change the start/end time (example, *-7d to *-1d). Following the example, your VBA would change the trend from showing daily averages over a week to hourly averages over a day.
You need to look at GetDataset, SetDataset in VBA for manipulating the PI Calculations based on your drop downs.
Principal Consultant
Real-Time Data Management @ Wipro Technologies