Alert is not working when variables is used the query

https://community.grafana.com/t/template-variables-are-not-supported-in-alert-queries-while-setting-up-alert/2514/16

Seems to be a long discussion already.