Card #3573 · Grafana
Difficulty implementing $__timeFilter macro in SQL queries
We are struggling to correctly use the $__timeFilter macro and other time macros in SQL queries across different data sources like MySQL and MSSQL. We encounter issues where queries either return errors, no rows, or display data points outside the selected time range.
Pain score
0.17/ 1.00 · weighted product of four components
Reach0.95distinct authors (log-normalized)
Recency1.00freshness decay, half-life months
Engagement0.43upvotes + comments, normalized
Monetization0.25willingness-to-pay cues in evidence
§ Evidence — 4 verified quotes
when I use $__timeFilter I get the ERROR :Unknown column '$__timeFilter' in ‘field list’.
when i add $__timeFilter(ExecutedAt) in where clause no rows are returned.
I tried use times macros in query for variables, but unsuccessfully.
I still need to declare the timefilter some how but have no idea how to do it with MSSQL.
Comments are a Pro feature — join the conversation, share what you've shipped, hear what others are building.
Upgrade to Pro