Calc average value in Report

I want to calculate the average value of a historical value within 24 hours, but this value may sometimes be 0 when the equipment is not running.
Is there any easy way to perform the correct calculation by removing the value (0) from the calculation?
if I want to use SQL to calculate the average historical values, which data table should I refer?

Select avg(tagvalue)
From table???
Where (tstamp between time1 and time2) AND (tgavalue > 0)

you can use scripting to filter the data and generate a new dataset without the null values

1 Like