In my KQL editor I have following query :
adt_history
| where SourceTimeStamp >= $__timeFrom and SourceTimeStamp <= $__timeTo
| where Id == 'VAT02' and Key == 'level'
| project SourceTimeStamp, Value=todouble(Value)
| order by SourceTimeStamp asc
This seems to work, but still I get an error line under $__timeFrom and $__timeTo.
“The name ‘$__timeFrom’ does not refer to any known column, table, variable or function.(KS142)”
Why is that?
I am very new to Grafana, but looking at it from a SQL stand syntax, have you tried placing the function with single quotes around the date? I believe it is if you do not give it quotes, it will try to reference it as a column in the DB instead of a value.
adt_history
| where SourceTimeStamp >= '$__timeFrom()' and SourceTimeStamp <= '$__timeTo()'
| where Id == 'VAT02' and Key == 'level'
| project SourceTimeStamp, Value=todouble(Value)
| order by SourceTimeStamp asc
Hey… i have quite the same problem. I have defined a variable ‘interval’ in grafana and use it in my KQL query.
customMetrics
| where name == ‘restaurant-order-svc-items-ordered’
| summarize sum(value) by bin(timestamp, $interval)
| order by timestamp asc
KQL also says ’ The name ‘$interval’ does not refer to any known column, table, variable or function.(KS142)’ but it works.
I guess KQL has only no access to the variables defined by grafana