Showing results for 
Show  only  | Search instead for 
Did you mean: 

Splitting Results by Calendar Day, Week, or Month?

DynaMight Champion
DynaMight Champion

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 and 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!

Observability Engineer at Phenisys - Dynatrace Professional

Dynatrace Mentor
Dynatrace Mentor

Hi @jegron,

yes this is possible.

Can you use the new functions getDayOfWeek, getWeekOfYear, etc., to convert a timestamp field. See following example query:

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

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):

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



Featured Posts