Using alias with $__timeFilter()

  • What Grafana version and what operating system are you using?
    v9.5.1 Windows 11

  • What are you trying to achieve?
    Setting a certian time variable as the target of the time selection in the top right by using an alias. TL;DR Can an alias be used in the $__timeFilter() command?

  • How are you trying to achieve it?
    I have a nested SQL query akin to the following:
    select name
    , (select MAX(Created) from timesheet where id = timesheet.id) as time
    , (select something from somethingelse) as something
    , date
    , color
    Where $__timeFilter(time)

  • What happened?
    Sheet errors out 1064

  • What did you expect to happen?
    I expected my named variable to be the target of the time slice in the top right (dropdown)

  • Can you copy/paste the configuration(s) that you are having problems with?
    Due to the propritay nature of my code, I cannot.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    Status: 500. Message: db query error: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘.Created BETWEEN FROM_UNIXTIME(1659029162) AND FROM_UNIXTIME(1690565162) #…’ at line 22

  • Did you follow any online instructions? If so, what is the URL?
    No