# Why does a DQL query with the same filtering return different counts from one with a Segment?

**URL:** <https://community.dynatrace.com/t/why-does-a-dql-query-with-the-same-filtering-return-different-counts-from-one-with-a-segment/55089>\
**Category:** DQL\
**Tags:** dql, segments, notebooks\
**Created:** [February 24, 2026, 12:40pm UTC](https://community.dynatrace.com/t/why-does-a-dql-query-with-the-same-filtering-return-different-counts-from-one-with-a-segment/55089 "2026-02-24T12:40:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gary-rogers](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@gary-rogers](https://community.dynatrace.com/u/gary-rogers)\
**Post date:** [February 24, 2026, 12:40pm UTC](https://community.dynatrace.com/t/why-does-a-dql-query-with-the-same-filtering-return-different-counts-from-one-with-a-segment/55089/1 "2026-02-24T12:40:46Z")

</div>

When I run this query without a segment I get 9 records:

```ruby
fetch dt.davis.problems
| filter event.status == "ACTIVE"
| filter matchesValue(k8s.cluster.name, { "production-01", "production-02", "production-03", "production-04" })

```

When I run it with a segment that implements the same filter I get 152. The Segment is defined as

```ruby
k8s.cluster.name in (production-01, production-02, production-03, production-04)

```

Same timeframe

What are Segments doing that result in more records being returned?

---

<div class="post-metadata">

**Author:** ![dannemca](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dannemca/32/7215_2.png) [@dannemca](https://community.dynatrace.com/u/dannemca)\
**Post date:** [February 24, 2026, 5:25pm UTC](https://community.dynatrace.com/t/why-does-a-dql-query-with-the-same-filtering-return-different-counts-from-one-with-a-segment/55089/2 "2026-02-24T17:25:13Z")

</div>

Could you show us the entire query you are doing using segment as filter?

---

<div class="post-metadata">

**Author:** ![gary-rogers](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@gary-rogers](https://community.dynatrace.com/u/gary-rogers)\
**Post date:** [February 24, 2026, 5:39pm UTC](https://community.dynatrace.com/t/why-does-a-dql-query-with-the-same-filtering-return-different-counts-from-one-with-a-segment/55089/3 "2026-02-24T17:39:35Z")

</div>

When using the segment I just comment out the last line.

```ruby
fetch dt.davis.problems
| filter event.status == "ACTIVE"
//| filter matchesValue(k8s.cluster.name, { "production-01", "production-02", "production-03", "production-04" })

```

Even if I don’t, I’m getting different results.

---

<div class="post-metadata">

**Author:** ![dannemca](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dannemca/32/7215_2.png) [@dannemca](https://community.dynatrace.com/u/dannemca)\
**Post date:** [February 24, 2026, 6:54pm UTC](https://community.dynatrace.com/t/why-does-a-dql-query-with-the-same-filtering-return-different-counts-from-one-with-a-segment/55089/4 "2026-02-24T18:54:01Z")

</div>

Tried to replicate in my environments but saw no differences in the result.

Let’s see if others can help.

---

<div class="post-metadata">

**Author:** ![gary-rogers](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@gary-rogers](https://community.dynatrace.com/u/gary-rogers)\
**Post date:** [February 24, 2026, 6:58pm UTC](https://community.dynatrace.com/t/why-does-a-dql-query-with-the-same-filtering-return-different-counts-from-one-with-a-segment/55089/5 "2026-02-24T18:58:23Z")

</div>

Thanks for the look!
