I can't reproduce this behavior with TagAvg (a time average with a single value in the range produces a result for me), but here are a few things to try:
1) You can check whether the return value was bad by using the BadVal function.
2) If there is an error when you Evaluate in PSE, near the bottom of the window there is typically more information on what caused the error.
I was able to get an error with TagMean (event weighted average) when there are no values in the range:
Thanks Mike. Please find below the analytics code. In the tests the analytics does not show any errors. But the output tag gets the value "Error"
IF BadVal(TagAvg('PI Alarm SS Successful Requests','*-10m','*')) THEN "Error" ELSE Roundfrac(TagAvg('PI Alarm SS Successful Requests','*-10m','*'),2)
This tag has one value in that timerange. When I use TagVal it works well. But I want to have the average calculated if there are more than one value.
Just wanted to update the post in case anyone else has this issue.
The issue was with data type mismatch between the analytics result and output tag. There was no way to find this out, since analytics always evaluated with right results in template as well as element.