# Variables of specific Type

**URL:** <https://community.dynatrace.com/t/variables-of-specific-type/43032>\
**Category:** Dashboarding\
**Tags:** dql\
**Created:** [December 5, 2023, 11:12am UTC](https://community.dynatrace.com/t/variables-of-specific-type/43032 "2023-12-05T11:12:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![r\_weber](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/r_weber/32/24884_2.png) [@r\_weber](https://community.dynatrace.com/u/r_weber)\
**Post date:** [December 5, 2023, 11:12am UTC](https://community.dynatrace.com/t/variables-of-specific-type/43032/1 "2023-12-05T11:12:26Z")

</div>

Is there a way to specify a dashboard variable of type “duration”?  
Or a way to convert a string to a duration within the makeTimeseries command, like this?

Aggregation = 1d,7d,30d

```markup
fetch logs, scanLimitGBytes: 5000
| filter isNotNull(k8s.deployment.name)
| filter loglevel == "INFO"
| fields k8s.deployment.name, chars=stringLength(content), timestamp
| makeTimeseries sum_content_chars=sum(chars), by: {k8s.deployment.name}, interval:asDuration($Aggregation)

```

The above DQL fails with “Execution failed with error: failure to statically evaluate expression”

---

<div class="post-metadata">

**Author:** ![zietho](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/zietho/32/41733_2.png) [@zietho](https://community.dynatrace.com/u/zietho)\
**Post date:** [December 7, 2023, 2:51pm UTC](https://community.dynatrace.com/t/variables-of-specific-type/43032/2 "2023-12-07T14:51:11Z")

</div>

E.g. with duration(toLong($resolution), unit:“m”))}

FInd an example here:&nbsp;[Add a variable to a dashboard — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/dashboard-component-variable#limitations-when-using-variables-in-tiles)

---

<div class="post-metadata">

**Author:** ![r\_weber](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/r_weber/32/24884_2.png) [@r\_weber](https://community.dynatrace.com/u/r_weber)\
**Post date:** [December 7, 2023, 5:11pm UTC](https://community.dynatrace.com/t/variables-of-specific-type/43032/3 "2023-12-07T17:11:12Z")

</div>

I tried that before in this form:

```markup
...
| makeTimeseries sum_content_chars=sum(chars), by: {k8s.deployment.name}, interval:duration(toLong($Aggregation),unit:d)

```

However this didn’t work:  
“The parameter `interval` has to be constant, but `duration(toLong(“1”), d)` accesses data.”

---

<div class="post-metadata">

**Author:** ![zietho](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/zietho/32/41733_2.png) [@zietho](https://community.dynatrace.com/u/zietho)\
**Post date:** [December 7, 2023, 11:12pm UTC](https://community.dynatrace.com/t/variables-of-specific-type/43032/4 "2023-12-07T23:12:36Z")

</div>

odd seems like there have been some changes.

What works for me is the following, where I just pass the unit as a second parameter:

 ![zietho_0-1701990573960.png](https://global.discourse-cdn.com/dynatrace/original/3X/8/f/8f6421d90d88afe61f1b913c7a3b241c21d3fb78.png)

timeseries avg(dt.host.cpu.idle), interval: duration(toLong(“2”),“d”)

---

<div class="post-metadata">

**Author:** ![r\_weber](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/r_weber/32/24884_2.png) [@r\_weber](https://community.dynatrace.com/u/r_weber)\
**Post date:** [December 8, 2023, 9:12am UTC](https://community.dynatrace.com/t/variables-of-specific-type/43032/5 "2023-12-08T09:12:04Z")

</div>

\*Facepalm\*…unit has to be a string!

```markup
| makeTimeseries sum_content_chars=sum(chars), by: {k8s.deployment.name}, interval:duration(toLong($Aggregation),unit:"d")

```

That works, also if the unit itself is a variable

---

<div class="post-metadata">

**Author:** ![zietho](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/zietho/32/41733_2.png) [@zietho](https://community.dynatrace.com/u/zietho)\
**Post date:** [December 9, 2023, 7:16am UTC](https://community.dynatrace.com/t/variables-of-specific-type/43032/6 "2023-12-09T07:16:30Z")

</div>

Totally missed the quotation marks! Well cool then I am happy it works for you! Keep us in the loop when you face other issues! Always on the lookout for variable feedback.
