Alerts in AWS Managed Grafana

I have an Amazon Timestream Database which I can use in Dashboards without any problems. However when trying to set up an Alert I always get a strange error message:

“Failed to evaluate queries and expressions: input data must be a wide series but got type long (input refid)”

My timestream database looks like this
DevEUI measure_name time measure_value::bigint measure_value::varchar
sample data:
A84041B841867DF4 distanz_mm 2024-03-27 10:34:24.336000000 1808 -
00404C4AADED14D4 distanz_mm 2024-03-27 10:30:05.960000000 2209 -

Using the following SQL statement creating the alert would then lead to the above error.

SELECT * FROM $__database.$__table WHERE measure_name=‘distanz_mm’ AND DevEUI=‘00404C4AADED14D4’

The strange thing is that I can use the same SQL statement in the Explore function or in dashboards and it will execute without errors.

Any help on this is highly appreciated.

OK so it seems the SQL query needs to be adjusted a bit.
Only time and measure_value::bigint needs to be selected:

SELECT time, measure_value::bigint FROM $__database.$__table WHERE measure_name=‘distanz_mm’ AND …

With this SQL query the alerts do work. Still not sure about the reason for the error message in the previous post though.