I found a bug when using $__interval_ms in the scripted field when interval variable used in script field.
1. Create a interval variable
values: 1m, 15m, 30m , 60m
2. Change example query interval
Change example query interval to $interval (Then by Data Histogram @timestamp …) on graph’s metrics tab
3. Change the metric options
Change the metric options - Script (Max @value) to _value/ $__interval_ms
By then, you can see everything works fine, but after you changed interval from the dropdown created by variable, you can see the query from Query inspector shown that the $__interval_ms is still the same.
I tried using $__interval_ms directly without variable interval with no problem.
Please consider to fix it and thank you all for your contribution in Grafana !