# Splitting Results by Calendar Day, Week, or Month?

**URL:** <https://community.dynatrace.com/t/splitting-results-by-calendar-day-week-or-month/41338>\
**Category:** DQL\
**Tags:** dql\
**Created:** [August 24, 2023, 6:17am UTC](https://community.dynatrace.com/t/splitting-results-by-calendar-day-week-or-month/41338 "2023-08-24T06:17:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jegron](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jegron/32/12797_2.png) [@jegron](https://community.dynatrace.com/u/jegron)\
**Post date:** [August 24, 2023, 6:17am UTC](https://community.dynatrace.com/t/splitting-results-by-calendar-day-week-or-month/41338/1 "2023-08-24T06:17:57Z")

</div>

Hello Dynatrace Community,

I’ve been working on some DQL queries recently and I’m trying to figure out if it’s possible to split the results by calendar intervals such as a day, week, or month. I’ve noticed the **bin** &nbsp;and&nbsp; **interval** parameter allows for relative intervals, but I’m looking for an absolute interval based on the calendar.

Has anyone encountered this before or knows how to achieve this?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![stefan\_eggersto](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/stefan_eggersto/32/34114_2.png) [@stefan\_eggersto](https://community.dynatrace.com/u/stefan_eggersto)\
**Post date:** [August 24, 2023, 6:33am UTC](https://community.dynatrace.com/t/splitting-results-by-calendar-day-week-or-month/41338/2 "2023-08-24T06:33:54Z")

</div>

Hi [@jegron](https://community.dynatrace.com/user/47129),

yes this is possible.

Can you use the new functions [getDayOfWeek](https://www.dynatrace.com/support/help/shortlink/dql-functions#getDayOfWeek), [getWeekOfYear](https://www.dynatrace.com/support/help/shortlink/dql-functions#getWeekOfYear), etc., to convert a timestamp field. See following example query:

```auto
fetch events
| fieldsAdd dayOfWeek = getDayOfWeek(timestamp)
| summarize count(), by:{dayOfWeek}

```

[formatTimestamp](https://www.dynatrace.com/support/help/shortlink/dql-functions#formatTimestamp) is a more generic alternative. You can format a timestamp to your needs based on a pattern (see the link in the doc for different patterns):

```auto
fetch events
| fieldsAdd dayOfWeek = formatTimestamp(timestamp, format: "E")
| summarize count(), by:{dayOfWeek}

```

 ![stefan_eggersto_0-1692858705879.png](https://global.discourse-cdn.com/dynatrace/original/3X/5/0/5055ff8311435ca6f25438abfd02db06a234bc58.png)
