How to calculate averages in PI DataLink

1.8k views Asked by At

How to calculate the averages of the last 4 hours of the variable FIC02 in the date of the cell DATE?

See below:

DATE FIC02
08-jan-08 06:30:00 ?
08-jan-08 13:30:00 ?
08-jan-08 20:30:00 ?

I'm using PI DataLink's 'Calculated data' function in Excel with:

start time: 08-jan-08 06:30:00 - (4/24)
end time 08-jan-08 06:30:00

The code used is below:
=PIAdvCalcVal("FIC02";"'Planilha1'!$A$6 - (4/24)";Planilha1!$A$6;"average";"time-weighted";0;1;0;"")

The following error message appears: The time is invalid.

1

There are 1 answers

0
Martin H On

You have to specify a time range

See below. I have a start time and 4h later an end time.

Adv Calc

If you need an hourly average over the same time range, then specify the optional "Time interval" As an example I calculate an hourly (60m=60minutes, you can also write 1h) average over the same timespan

enter image description here

You can indeed make a calculation relative to a single time field. Just make sure the time format in excel is correct.

As you ca see both ways (start end time & end time - 5h) yields the same result,

enter image description here