Convert alert to expression

I have a panel in Grafana dashboard with two queries, A and B.
The alert that is defined for them is like so

I want to convert it to an expr, I tried this
avg_over_time(A[5m:1m]) > 20 or avg_over_time(B[5m:1m]) > 15
but it didn’t work for me.
do you have any suggestions ?

@iaomari93 Welcome to the forum.

What version of Grafana are you using?

Hey @grant2
Im using v8.5.14

I would recommend upgrading to the latest version of Grafana. The alerting features have been given a major overhaul and you are using what is called legacy alerting.

How many alerts do you have working in your current version right now? You should expect to spend some time redoing alerts in the new version of Grafana.