you need a group by time on the outer query as well, your just summing and returning a single value in the outer query I think.
Not an expert in InfluxDB sub queries. Try using the query inspector (introduced in Grafana v4.6 in metrics tab) to inspect the response from influxdb.
For me also same error was coming but then i appended “Where $timefilter” in the outer query it worked for me.
eg.
SELECT sum(coveredFieldsCount)/sum(specFieldsCount)*100 as Coverage from (SELECT LAST(“specFieldsCount”) as specFieldsCount, LAST(“coveredFieldsCount”) as coveredFieldsCount FROM “apitestagent_apicoverage_metadata” WHERE (“businessPurpose” =~ /^business/ ) AND $timeFilter GROUP BY “apiId” order by asc) WHERE $timeFilter