Count data showing properly in influxdb table, but in grafana visualisation sometimes not correct

I have written the following query

import “date”
every = 1m
offset = duration(v: string(v: uint(v: now()) - uint(v:date.truncate(t: now(), unit: every))) + “ns”)

from(bucket: v.defaultBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “SENSOR_MEASUREMENT”)
|> filter(fn: (r) => r[“_field”] == “pID”)
|> filter(fn: (r) => r[“dID”] =~ /^${dID:regex}$/ )
|> window(every: every, offset: offset)
|> count()

When I view every past 1 minute data in influxdb table format, I am able to verify 12 packets are present at all times
But in grafana sometimes all 12 are present and if i refresh it again, sometimes it is not counting properly

Below is a screenshot, which sometimes doesn’t count properly

Instead of some 11’s and 12’s, all should be 12 irrespective of the refreshes I do.

I think it is due to 1-2 milliseconds or nanoseconds not getting included, due to which this is happening, can someone help me with this?