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.
Thanks Sam. You are right. Since that I was using the EventWeighted and there was no 'event' for the given time frame. The SDK calls throw an error. Once I switched it over to use TimeWeighted , and I was able to receive the average value as displayed in Data Link without error.
Thanks for ur suggestion. it helps !