# Dashboards with filtering data using variables

**URL:** <https://community.dynatrace.com/t/dashboards-with-filtering-data-using-variables/51483>\
**Category:** Dashboarding\
**Tags:** dql, dashboards\
**Created:** [May 5, 2025, 4:48pm UTC](https://community.dynatrace.com/t/dashboards-with-filtering-data-using-variables/51483 "2025-05-05T16:48:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![patryk\_ozimek2](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@patryk\_ozimek2](https://community.dynatrace.com/u/patryk_ozimek2)\
**Post date:** [May 5, 2025, 4:48pm UTC](https://community.dynatrace.com/t/dashboards-with-filtering-data-using-variables/51483/1 "2025-05-05T16:48:39Z")

</div>

Hi,

I have a dashboard with variable captured from bizevents data. It is a numeric value (type long). I want to filter bizevents for values choosen in the variable list. Single value works fine because it is enough to use “| filter positionDepot == toLong($positionDepot)”. In the multiselect in my opinion I should use “| filter in(positionDepot, array($positionDepot)”

But it doesn’t work. I mean there is no error but tile says “The are no records”

The workaround for it is:

Variable definition:

fetch bizevents  
| filter event.provider == “XXXXX”  
| fields positionDepot = toString(positionDepot)  
| summarize positionDepot = collectDistinct(positionDepot)

Tile DQL query:

fetch bizevents  
| filter event.provider == "XXXXX  
| filter in(toString(positionDepot), array($positionDepot))  
| fields timestamp, positionDepot

In this setup everything works fine but in my opinion it can be done in a proper way.

Any ideas how to do it?

Best Regards  
Patryk

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [May 6, 2025, 7:57am UTC](https://community.dynatrace.com/t/dashboards-with-filtering-data-using-variables/51483/2 "2025-05-06T07:57:45Z")

</div>

Hi,

I will provide and example to filter a table by hostname.

Variable:

```markup
fetch dt.entity.host
| fieldsKeep entity.name

```

DQL query:

```markup
fetch dt.entity.host
| filter in(entity.name, array($HOSTNAME))

```

Important is variable only return values about one dimension. I am using “fieldsKeep” to have just values in one field.

I would use something as that, instead of summarize + collectDistinct.

Best regards
