<?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 Re: User Sessions Query Language - use alias in WHERE clause in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/272999#M3671</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/88175"&gt;@plespera&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Good to know. Thanks for sharing it.&lt;/P&gt;&lt;P&gt;Maybe&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/1433"&gt;@HannahM&lt;/a&gt;&amp;nbsp;can confirm your assumption regarding the useage of aliases in the WHERE block.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;János&lt;/P&gt;</description>
    <pubDate>Wed, 19 Mar 2025 19:14:51 GMT</pubDate>
    <dc:creator>Mizső</dc:creator>
    <dc:date>2025-03-19T19:14:51Z</dc:date>
    <item>
      <title>Use alias in WHERE clause for User Sessions Query Language</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/272969#M3668</link>
      <description>&lt;P&gt;Hello, I am trying to write a user sessions query to measure the number of user sessions per hour. I wish to only consider data from working days of the week (Monday to Friday).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="6"&gt;Point 1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When I run the following query:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SELECT HOUR(startTime) AS timeOfDay, DATETIME (startTime, "E", "1d") as dayOfWeek, COUNT(*) FROM usersession WHERE useraction.application IS 'myApp' AND dayOfWeek IN ('Mon', 'Tue', 'Wed', 'Thu', 'Fri') GROUP BY timeOfDay&lt;/LI-CODE&gt;
&lt;P&gt;I get the error message&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;Unknown field:&amp;nbsp;&lt;/SPAN&gt;dayOfWeek&lt;FONT color="#000000"&gt;, with the field dayOfWeek in the WHERE clause highlighted.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;I tried the following as well:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SELECT HOUR(startTime) AS timeOfDay, startTime, COUNT(*) FROM usersession WHERE useraction.application IS 'dxcoe-agora - prod' AND DATETIME(startTime, "E", "1d") IN ('Mon', 'Tue', 'Wed', 'Thu', 'Fri') GROUP BY timeOfDay&lt;/LI-CODE&gt;
&lt;P&gt;And was met with a generic &lt;FONT color="#FF0000"&gt;Query parsing error&lt;/FONT&gt; underlining the DATETIME function.&lt;/P&gt;
&lt;P&gt;Any way to achieve what I'm trying to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="6"&gt;&lt;STRONG&gt;Point 2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;I was also wodnering if there was any way to display hours on the line chart where there are no suer sessions (for example, if there are no usersessions at 6pm, I'd like the line chart to still show 6pm and the value of 0).&lt;/P&gt;</description>
      <pubDate>Mon, 15 Dec 2025 11:56:19 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/272969#M3668</guid>
      <dc:creator>plespera</dc:creator>
      <dc:date>2025-12-15T11:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: User Sessions Query Language - use alias in WHERE clause</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/272986#M3669</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/88175"&gt;@plespera&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think startTime does not include the day of the week.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_0-1742405113558.png" style="width: 800px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27057i29A06FC2EEE5D179/image-dimensions/800x92?v=v2" width="800" height="92" role="button" title="Mizs_0-1742405113558.png" alt="Mizs_0-1742405113558.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I saw this section in the documneation but I have not found any examples for the day of the weeks.&lt;/P&gt;&lt;P&gt;Or how can we change the default format where we can use "E".&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_1-1742405329320.png" style="width: 650px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27058i9F39412413BA5C0F/image-dimensions/650x346?v=v2" width="650" height="346" role="button" title="Mizs_1-1742405329320.png" alt="Mizs_1-1742405329320.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;János&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 17:30:15 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/272986#M3669</guid>
      <dc:creator>Mizső</dc:creator>
      <dc:date>2025-03-19T17:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: User Sessions Query Language - use alias in WHERE clause</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/272992#M3670</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/47783"&gt;@Mizső&lt;/a&gt;, that's not true, as I am able to select the startTime transformed as a day of week using the DATETIME function.&lt;/P&gt;&lt;P&gt;The following query poses no issues:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT HOUR(startTime) AS timeOfDay, DATETIME(startTime, "E", "1d") as dayOfWeek, COUNT(*) FROM usersession WHERE useraction.application IS 'myApp' GROUP BY timeOfDay&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="plespera_0-1742408410955.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27062i19A82374048702C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="plespera_0-1742408410955.png" alt="plespera_0-1742408410955.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But as soon as I try to use one of the column aliases in the WHERE block, the query fails with the aformentioned issues. I've tried timeOfDay alias and get the same error.&lt;/P&gt;&lt;P&gt;My feeling right now is that it is not possible to reference aliases or use functions in the WHERE block, but I have not found documentation or a similar question confirming that this is the case.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 18:22:48 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/272992#M3670</guid>
      <dc:creator>plespera</dc:creator>
      <dc:date>2025-03-19T18:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: User Sessions Query Language - use alias in WHERE clause</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/272999#M3671</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/88175"&gt;@plespera&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Good to know. Thanks for sharing it.&lt;/P&gt;&lt;P&gt;Maybe&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/1433"&gt;@HannahM&lt;/a&gt;&amp;nbsp;can confirm your assumption regarding the useage of aliases in the WHERE block.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;János&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 19:14:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/272999#M3671</guid>
      <dc:creator>Mizső</dc:creator>
      <dc:date>2025-03-19T19:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: User Sessions Query Language - use alias in WHERE clause</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/273734#M3679</link>
      <description>&lt;P&gt;Yes, unfortunately WHERE conditions only work on fields.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 17:05:07 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Use-alias-in-WHERE-clause-for-User-Sessions-Query-Language/m-p/273734#M3679</guid>
      <dc:creator>HannahM</dc:creator>
      <dc:date>2025-03-27T17:05:07Z</dc:date>
    </item>
  </channel>
</rss>

