<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Calender-aware durations in DQL in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Calender-aware-durations-in-DQL/m-p/232166#M432</link>
    <description>&lt;P&gt;Likely more an RFE than a question...&lt;/P&gt;&lt;P&gt;Currently DQL only supports duration types of "ns" to "d" (&lt;A href="https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/data-types#timeframe" target="_self"&gt;here&lt;/A&gt;).&lt;BR /&gt;However especially with BizEvents you want to have something like calendar/week/month-aware durations and timeframes.&lt;BR /&gt;E.g. I'm tracking orders and revenue. I want to create a report/dashboard that shows data of this month/last month, last six months, this week, previous week.&lt;BR /&gt;I don't see how this can be done right now?&lt;/P&gt;</description>
    <pubDate>Mon, 18 Dec 2023 09:43:52 GMT</pubDate>
    <dc:creator>r_weber</dc:creator>
    <dc:date>2023-12-18T09:43:52Z</dc:date>
    <item>
      <title>Calender-aware durations in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Calender-aware-durations-in-DQL/m-p/232166#M432</link>
      <description>&lt;P&gt;Likely more an RFE than a question...&lt;/P&gt;&lt;P&gt;Currently DQL only supports duration types of "ns" to "d" (&lt;A href="https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/data-types#timeframe" target="_self"&gt;here&lt;/A&gt;).&lt;BR /&gt;However especially with BizEvents you want to have something like calendar/week/month-aware durations and timeframes.&lt;BR /&gt;E.g. I'm tracking orders and revenue. I want to create a report/dashboard that shows data of this month/last month, last six months, this week, previous week.&lt;BR /&gt;I don't see how this can be done right now?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 09:43:52 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Calender-aware-durations-in-DQL/m-p/232166#M432</guid>
      <dc:creator>r_weber</dc:creator>
      <dc:date>2023-12-18T09:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calender-aware durations in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Calender-aware-durations-in-DQL/m-p/232197#M433</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/35901"&gt;@r_weber&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently there is not an easy way of doing this&lt;/P&gt;
&lt;P&gt;Revenue of this month&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;fetch bizevents, from: bin(now()-duration(getDayOfMonth(now())-1,unit:"d"),1d, at: -1h)
| summarize sum(amount)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;revenue of last month&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;fetch bizevents, 
  from: totimestamp(if(formatTimestamp(now(), format:"M") == "1", 
  concat(getYear(now()) -1,"-12-01-01"), else: (concat(getYear(now()), "-",toLong(formatTimestamp(now(), format:"M"))-1, "-01-01")))),
  to: bin(now()-duration(getDayOfMonth(now())-1,unit:"d"),1d, at: -1h)
| summarize sum(amount)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;revenue of this week&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;fetch bizevents, from: bin(now()-duration(getDayOfWeek(now())-1,unit:"d"),1d, at: -1h)
| summarize sum(amount)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;revenue of last week&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;fetch bizevents, 
  from: toTimestamp(concat(getYear(now()-7d), "-01-01"))
    + duration((getWeekOfYear(now()-7d)-1)*7+1, "d"),
  to: bin(now()-duration(getDayOfWeek(now())-1,unit:"d"),1d, at: -1h)
| filter isNotNull(amount)
| summarize sum(amount)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;revenue of last six month I think is also possible just with a more complex and nested usage of if function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Sini&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 10:50:29 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Calender-aware-durations-in-DQL/m-p/232197#M433</guid>
      <dc:creator>sinisa_zubic</dc:creator>
      <dc:date>2023-12-18T10:50:29Z</dc:date>
    </item>
  </channel>
</rss>

