Converting a string variable (1m, 1h, 1d) for use in interval

Hi,

I have created a variable group_by in Dashboards/Notrbook to be able to group the result of a query. But I don’t know how to transform this string into a valid value:

fetch events
| filter event.kind == "DAVIS_PROBLEM"
| summarize {count = count(),event.status_transition = takeLast(event.status)}, by: {status = event.status_transition,`interval` = bin(timestamp, $group_by)}

I haven’t seen how I can do that in the documentation: DQL functions — Dynatrace Docs

Many thanks


Hi @Duran_Narbona

There is a similar example in our help: Add a variable to a dashboard — Dynatrace Docs

Just add 2 variables to dashboard, one for resolution and one for unit.

Then the query can look like this:

fetch events
| filter event.kind == "DAVIS_PROBLEM"
| fieldsAdd toDuration(multiplier)
| summarize {count = count(),event.status_transition = takeLast(event.status)}, by: {status = event.status_transition,`interval` = bin(timestamp, duration($resolution, unit:$unit))}

Best,
Sini