2 Replies Latest reply on Mar 26, 2014 6:03 PM by ChewCheeLim

    [Average, [-11057] Not Enough Values For Calculation] Error

      Hi There, I am getting this error while retrieving data for computed values. --> hourly average. code snippet:- AFTimeRange oRange = new AFTimeRange(dtBegin, dtEnd);             IDictionary aPiValues = null;             try             {                 aPiValues = oAfAttribute.Data.Summary(oRange,AFSummaryTypes.Average ,AFCalculationBasis.EventWeighted, AFTimestampCalculation.Auto);                              } Hourly date range:- {3/15/2014 12:00:00 AM - 3/15/2014 1:00:00 AM } Error received in aPiValues object Count = 1 [0]: {[Average, [-11057] Not Enough Values For Calculation]} Is there a min PI data required for this Average computation? How about Min() and Max(). We are using those computed values as well. Many thanks!
        • Re: [Average, [-11057] Not Enough Values For Calculation] Error
          Sam Pride

          There needs to be at least 1 value for the calculation to return an event-weighted average. The error message you are receiving is thrown when there are no events in your time period.


          Remember that an event-weighted average is a discreet average of all events within the time period. A time-weighted average takes into account how long the tag was at that value and weights accordingly. As such, you will need at least one event for an event-weighted average but you can use the snapshot/previous value for a time-weighted average as theoretically nothing is changing.


          Can you confirm that you have data available for your tag? Another thing to be wary of is subtle differences in time between the client and the server - it could adjust your time period ever so slightly but just enough to miss your value.


          Another great tip is to try the query in DataLink (Advanced calculated data in this case) as it mimics the SDK calls quite closely. If all else fails, contact TechSupport and they can work through checking if the tag and server is healthy.