# Querying services related to an entity

**URL:** <https://community.dynatrace.com/t/querying-services-related-to-an-entity/47960>\
**Category:** DQL\
**Tags:** dql, dynatrace-managed, logs\
**Created:** [September 24, 2024, 8:24pm UTC](https://community.dynatrace.com/t/querying-services-related-to-an-entity/47960 "2024-09-24T20:24:33Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![DamianJankowski](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/damianjankowski/32/10540_2.png) [@DamianJankowski](https://community.dynatrace.com/u/DamianJankowski)\
**Post date:** [September 24, 2024, 8:24pm UTC](https://community.dynatrace.com/t/querying-services-related-to-an-entity/47960/1 "2024-09-24T20:24:33Z")

</div>

I want to create a line chart that displays the response time metric for a selected service. I need it to be dynamic, so I’ve set up a variable. Here’s the variable definition:

```cpp
fetch dt.entity.service
| fields entity.name

```

When the user selects an entity.name, the line chart should update and display the corresponding metric for that service.

I’ve tried the following query:

```python
timeseries response_time = percentile(dt.service.request.response_time, 50),
by: { dt.entity.service },
filter: { in(id, classicEntitySelector("type(service),fromRelationship.IS_SERVICE_OF(type(CLOUD_APPLICATION),entityName.equals($Entity'))")) }

```

---

_[View the full topic](https://community.dynatrace.com/t/querying-services-related-to-an-entity/47960)._
