I’m not sure what I’m doing wrong here… hoping someone here can help me with this… I feel like it should be simple…
I have field that stores the number of profiles. I have Grafana panels indicating the number of new profiles in the past minute, hour, day, and 7 days. Everything seems to work properly except the 7 days one (which was working until recently).
So if I have a query like this for the “past minute” panel, it works:
SELECT difference(distinct("user_profiles")) FROM "data" WHERE time >= now()-2d GROUP BY time(1m)
Keep in mind, the now()-2d
is just a representation of the time scale set in my Grafana dashboard. The panel is also set to use the “current” value under options.
I have this same for each of the other time ranges (1h, 1d, and 7d). Up until last week, the 7d value seemed to be working just fine… but looked at my panel today and the value is wrong.
Now, if I set the where clause to time >=now()-7d
, it works. I get the right value. In fact, setting it to 4d, 5d, 6d, or 7d works (i.e. it returns the same correct “difference”), but 3d or less causes it to return the wrong value.
Am I not “doing” the differences the right way? What’s driving me really crazy is that it was returning the right value for many days since I set this up…
Thanks for any insight!