Hi everyone,

I need to calculate daily average truck speeds with certain filters in place. Doing this in Excel using PI Datalink is easy, however doing the same in AF Analysis is a bit more tricky. I've used this guide to setup my calculations:

My problem is that I don't get the same answer using PI Datalink and using AF Analysis:

- PI Datalink: 17.307
- AF Analysis: 16.727

See below for how calculations was setup. Any idea what I'm doing wrong?

**DataLink Calculations**

Data Item: Truck.Speed

Filter: ('Truck.Status'=228) AND ('Truck.Speed'>0) AND ('Truck.NetworkProblem'=0)

From: '*-1D'

To: '*'

Calculation Mode: average (time-weighted)

Answer: 17.307

**AF Calculation**

First I create a formula data reference attribute (Filtered Speed) with the following formula:

A=Speed;B=NetworkProblem;C=Status;[if A > 0 and B == 0 and C == 228 then A else 0]

Then I create an Analysis:

Answer: 16.727

Hi Franco,

The first thought that comes to mind here is that as you are using a moving relative time period ('*-1d' to '*'), do you still get different results if you use a fixed time period in both DataLink and AF:

StartTime = 'y'

EndTime = 't'

The difference you noted between the two results is small enough that it could be accounted for by the different relative times resolved by both methods. Using a fixed (non-moving) time range would at least allow you to eliminate the possibility that the difference is not due to two slightly different time ranges being used in your calculations.