# DQL to filter problem events by alerting profile

**URL:** <https://community.dynatrace.com/t/dql-to-filter-problem-events-by-alerting-profile/43355>\
**Category:** DQL\
**Tags:** dql, notebooks\
**Created:** [December 24, 2023, 1:30am UTC](https://community.dynatrace.com/t/dql-to-filter-problem-events-by-alerting-profile/43355 "2023-12-24T01:30:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![dneimke](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@dneimke](https://community.dynatrace.com/u/dneimke)\
**Post date:** [December 24, 2023, 8:11am UTC](https://community.dynatrace.com/t/dql-to-filter-problem-events-by-alerting-profile/43355/3 "2023-12-24T08:11:58Z")

</div>

Thanks&nbsp;[@Yosi\_Neuman](https://community.dynatrace.com/user/6931), that worked!

As a follow up… do you know if it’s possible to declare and use variables in grail queries? Similar to using [the let statement in kusto queries](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/letstatement).

For example, something like this psuedo-code:

```csharp
// declare a variable
let p = "my_alerting_profile_name"

fetch events, from:now()-30d, to:now()  
... omitted for brevity
| filter matchesValue(profile, $p) // <-- use the variable here

```

Note: I’m using these queries in a Notebook

---

_[View the full topic](https://community.dynatrace.com/t/dql-to-filter-problem-events-by-alerting-profile/43355)._
