InfluxDB qurey result "no result" instead of "0", how to display 0 in grafana

I saved data in InfluxDB, I want to count how many record saved as per time, when there is not record during the selected time range, we get “no result” instead of “0”, if we get “no result”, we can not visualization it(0) in grafana, let me know how to display “0” in grafana instead of “no data”.


You can use if else statement as below

if timerange="no result" then

how to do in grafana, I use grafana V9.1.4, for example the A query is “no result”,so I can not display the percentage, how to let A return 0 in grafana? really appreciated…

it stuck me for several days…


You can use

select column1, isnull(timerange,0) as timerange from table

Then it will display 0 in place of “no result”

can you give me more details, in my case, the grafana query is as below, how to modify to let it display 0 instead of “no data”, sorry I am fresh.
SELECT count(“Supervision_Mode”) FROM “autogen”.“BMM3” WHERE $timeFilter AND “Supervision_Mode”=TRUE

waiting for your answer…


SELECT count(“Supervision_Mode”) FROM “autogen”.“BMM3” WHERE $timeFilter AND “Supervision_Mode”=TRUE

from the above query I am not able to find the column which displays “no data”

Hello, this means for the selected time filter, influxDB return “no result” because not record satisfied this query. I want to return 0

return 0 and display 0 in grafana

Yes, for that particular time the timefilter will return 0 and display 0 in grafana

just do it on Grafana panel, there is an option to display whatever you want when there is no result from the query.