How to get mean of partial available data in TICK script

influxdb
telegraf

#1

Hi,

This is how my data looks like in past 24 hours.

we can clearly see only couple of hours data is only available in the middle.

I am aiming to obtain average of what ever data available in past 24 hours. But my output isn’t giving any result.
Here is the TICK Script.

var Average = batch
    |query('''SELECT mean(voc) AS voc_0015BC0036000018 FROM "sensordata"."autogen"."voc"  WHERE eui = '0015BC0036000018' ''')
        .period(24h)
        .every(30s)
        .fill('null')
    |httpOut('step1')

Step1 httpoutput:
{"series":null}

Just wanted to get the average of the data. If 10 points are available, just get the average 10 points. I have tried using both fill(0) and fill(‘null’) .

Thanks