$__timeFrom and $_timeTo

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