# How to get process availability using DQL

**URL:** <https://community.dynatrace.com/t/how-to-get-process-availability-using-dql/51702>\
**Category:** DQL\
**Tags:** dql, grail\
**Created:** [May 20, 2025, 12:52pm UTC](https://community.dynatrace.com/t/how-to-get-process-availability-using-dql/51702 "2025-05-20T12:52:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![heramb\_sawant](https://avatars.discourse-cdn.com/v4/letter/h/c4cdca/32.png) [@heramb\_sawant](https://community.dynatrace.com/u/heramb_sawant)\
**Post date:** [May 20, 2025, 12:52pm UTC](https://community.dynatrace.com/t/how-to-get-process-availability-using-dql/51702/1 "2025-05-20T12:52:46Z")

</div>

Hi ,  
I need help to built DQL to&nbsp; get process&nbsp; availability in % , Can somebody please help on this.

Regards,  
Heramb Sawant

---

<div class="post-metadata">

**Author:** ![krzysztof\_hoja](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/krzysztof_hoja/32/34625_2.png) [@krzysztof\_hoja](https://community.dynatrace.com/u/krzysztof_hoja)\
**Post date:** [May 20, 2025, 4:06pm UTC](https://community.dynatrace.com/t/how-to-get-process-availability-using-dql/51702/2 "2025-05-20T16:06:19Z")

</div>

It requires getting all timeseries of availability state for process (in my example for process\_group) and then calculating percentage of existence of availability state vs all states.

In my sample case it looks like this:

 ![krzysztof_hoja_0-1747756931613.png](https://global.discourse-cdn.com/dynatrace/original/3X/8/5/8569d82a25f58b881cef918930ddbe2f176c212a.png)

```markup
timeseries availability=sum(dt.process.availability), by:{availability.state, dt.entity.process_group}
, filter:in(dt.entity.process_group, {"PROCESS_GROUP-0517A6E81E811092"})
, interval:5m
| summarize { availability = 100*sum(if(availability.state=="available",availability[])) / sum(availability[])}, 
by: {interval, timeframe, dt.entity.process_group}

```

by executing this query you can look at the data behind:

```markup
timeseries availability=sum(dt.process.availability), by:{availability.state, dt.entity.process_group, dt.entity.process_group_instance}
, filter:in(dt.entity.process_group, {"PROCESS_GROUP-0517A6E81E811092"})
, interval:5m

```

 ![krzysztof_hoja_1-1747757099116.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/3/4357dff5b93a1cfb434df638b844b03562671601.png)

there are 2 PGIs over time and at certain moment 2 of them become unavailable.

---

<div class="post-metadata">

**Author:** ![GerardJ](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/gerardj/32/154_2.png) [@GerardJ](https://community.dynatrace.com/u/GerardJ)\
**Post date:** [May 21, 2025, 7:07am UTC](https://community.dynatrace.com/t/how-to-get-process-availability-using-dql/51702/3 "2025-05-21T07:07:38Z")

</div>

[@krzysztof\_hoja](https://community.dynatrace.com/user/25373)&nbsp;&nbsp;top answer! every time your answers go into my bookmarks!  
Just a quick note because until recently I didn’t know it was possible to use a conditional function inside an aggregation function, until I tried it and hoped it would work.  
Looking at the documentation, there’s no such example and there’s a countif() function while there’s no sumif() or anything else. So it would be nice to have more examples of how to do conditional aggregations in the documentation. I’ve also recently had the same thought about the iCollectArray function, which is very powerful but not well reflected in the documentation because there aren’t enough examples of its use.

---

<div class="post-metadata">

**Author:** ![krzysztof\_hoja](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/krzysztof_hoja/32/34625_2.png) [@krzysztof\_hoja](https://community.dynatrace.com/u/krzysztof_hoja)\
**Post date:** [May 21, 2025, 7:26am UTC](https://community.dynatrace.com/t/how-to-get-process-availability-using-dql/51702/4 "2025-05-21T07:26:21Z")

</div>

I agree! Doc should contain more examples
