How to Display the "Last value in Database". Grafana plots zero when no change in that value

I have a time series Graph panel that displays the sensor value. sensor value hardly changes and it’s either 1,2 or 3. I could see the last value changed on Jan 18 and it remains the same till now. But Grafana displays Null when there is no change. I tried below query to fill the value with 3 when Null. It works when I am viewing data for “this year so far” but when I change it to “Last 6 hours” or “This week”, it shows “No Data Points”

SELECT __timeGroup("eventstamp",'5m',3), (sensorvalue) as sensorvalue FROM sensordata WHERE __timeFilter(eventstamp) AND
machineid = 7709 AND sensorid = 10206