# How to build a DQL query that accounts for timestamp discrepancies

**URL:** <https://community.dynatrace.com/t/how-to-build-a-dql-query-that-accounts-for-timestamp-discrepancies/46109>\
**Category:** DQL\
**Tags:** dql\
**Created:** [June 13, 2024, 3:40pm UTC](https://community.dynatrace.com/t/how-to-build-a-dql-query-that-accounts-for-timestamp-discrepancies/46109 "2024-06-13T15:40:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick-Montana](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/nick-montana/32/2051_2.png) [@Nick-Montana](https://community.dynatrace.com/u/Nick-Montana)\
**Post date:** [June 13, 2024, 3:40pm UTC](https://community.dynatrace.com/t/how-to-build-a-dql-query-that-accounts-for-timestamp-discrepancies/46109/1 "2024-06-13T15:40:22Z")

</div>

Greetings,

I am capturing the JSON response body of a transaction as a bizEvent in Dynatrace. Everything looks good except for one discrepancy that I need help accounting for. As you can see from the screenshot below occasionally the Agent captures the json response body in quick successions one after the other and every value within the record is the same. Ultimately this make the my resulting summations inaccurate. Below the highlighted timestamps in the normal behavior for capture intervals. So we can assume that if all the values in the record are the same and there is more than 1 record within a short amount of time (lets say 2-5 minutes) then in truth there is only a single transaction taking place

So how would I write a DQL query that combines n\>1 transactions if all other values are the same besides the timestamp?

 ![NickMontana_0-1718292784500.png](https://global.discourse-cdn.com/dynatrace/original/3X/9/b/9b782221cd8e6e62b58002cace8cfbad1ddff708.png)

---

<div class="post-metadata">

**Author:** ![joeistyping](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/joeistyping/32/26040_2.png) [@joeistyping](https://community.dynatrace.com/u/joeistyping)\
**Post date:** [June 14, 2024, 4:17pm UTC](https://community.dynatrace.com/t/how-to-build-a-dql-query-that-accounts-for-timestamp-discrepancies/46109/2 "2024-06-14T16:17:30Z")

</div>

Hi Nick thanks for asking!

If the other fields are unique to a particular transaction (like request id), you can summarize and get the # unique transactions (number of unique records).

As an example below, I grab a few bizevents including timestamps, all related to the some similar traceparents:

 ![joeistyping_0-1718380988034.png](https://global.discourse-cdn.com/dynatrace/original/2X/3/37e31529426fe1270168e13a56992918d09cd58c.png)

by using summarize you can group records together, use the timestamp of the earliest data sent and append any optional fields too.

If you would like add other fields, append them to the “by” clause

```ruby
| summarize timestamp=takeLast(timestamp), by:{traceparent, dt.entity.process_group}

```

Resulting in 2 unique records (2 unique requests):

 ![joeistyping_3-1718381798009.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/2/12f1dd8664feaaf0c21d3938eed2209ea5b4ed8e.png)

Hope this helps!
