<?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 How to get the differnce betweent two timestamp in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/How-to-get-the-differnce-betweent-two-timestamp/m-p/290184#M2817</link>
    <description>&lt;P&gt;Hello i have this code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;| fieldsAdd FechaTs = toTimestamp(Fecha)&lt;BR /&gt;| summarize&lt;BR /&gt;FechaInicial = min(FechaTs),&lt;BR /&gt;FechaFinal = max(FechaTs),&lt;BR /&gt;by: { Identificador }&lt;BR /&gt;| fieldsAdd&lt;BR /&gt;DiffMs = toLong(FechaFinal - FechaInicial),&lt;BR /&gt;DiffSec = toLong((FechaFinal - FechaInicial) / 1000)&lt;BR /&gt;| sort DiffMs desc&lt;/P&gt;</description>
    <pubDate>Tue, 25 Nov 2025 10:33:37 GMT</pubDate>
    <dc:creator>marusla</dc:creator>
    <dc:date>2025-11-25T10:33:37Z</dc:date>
    <item>
      <title>How to get the differnce betweent two timestamp</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-get-the-differnce-betweent-two-timestamp/m-p/290184#M2817</link>
      <description>&lt;P&gt;Hello i have this code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;| fieldsAdd FechaTs = toTimestamp(Fecha)&lt;BR /&gt;| summarize&lt;BR /&gt;FechaInicial = min(FechaTs),&lt;BR /&gt;FechaFinal = max(FechaTs),&lt;BR /&gt;by: { Identificador }&lt;BR /&gt;| fieldsAdd&lt;BR /&gt;DiffMs = toLong(FechaFinal - FechaInicial),&lt;BR /&gt;DiffSec = toLong((FechaFinal - FechaInicial) / 1000)&lt;BR /&gt;| sort DiffMs desc&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2025 10:33:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-get-the-differnce-betweent-two-timestamp/m-p/290184#M2817</guid>
      <dc:creator>marusla</dc:creator>
      <dc:date>2025-11-25T10:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the differnce betweent two timestamp</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-get-the-differnce-betweent-two-timestamp/m-p/290190#M2818</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/86794"&gt;@marusla&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can calculate the difference directly during the pipeline by adding a new field that performs the subtraction between the two values you already computed.&lt;/P&gt;&lt;P&gt;For example, after defining DiffMs and DiffSec, simply add:&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;| fieldsAdd Difference = DiffMs - DiffSec&lt;/LI-CODE&gt;&lt;P&gt;So your full query would look like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fieldsAdd FechaTs = toTimestamp(Fecha) | summarize FechaInicial = min(FechaTs), FechaFinal = max(FechaTs), by: { Identificador } | fieldsAdd DiffMs = toLong(FechaFinal - FechaInicial), DiffSec = toLong((FechaFinal - FechaInicial) / 1000) | fieldsAdd Difference = DiffMs - DiffSec | sort DiffMs desc&lt;/LI-CODE&gt;&lt;P&gt;This adds a new column with the subtraction result without modifying the rest of your logic.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Mon, 24 Nov 2025 21:37:03 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-get-the-differnce-betweent-two-timestamp/m-p/290190#M2818</guid>
      <dc:creator>JeanBlanc</dc:creator>
      <dc:date>2025-11-24T21:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the differnce betweent two timestamp</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-get-the-differnce-betweent-two-timestamp/m-p/290192#M2819</link>
      <description>&lt;P&gt;i use the commands, but stil have the problem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marusla_0-1764020725469.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/30995i6E70E9714A070A09/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marusla_0-1764020725469.png" alt="marusla_0-1764020725469.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Nov 2025 21:45:48 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-get-the-differnce-betweent-two-timestamp/m-p/290192#M2819</guid>
      <dc:creator>marusla</dc:creator>
      <dc:date>2025-11-24T21:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the differnce betweent two timestamp</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-get-the-differnce-betweent-two-timestamp/m-p/290197#M2820</link>
      <description>&lt;P&gt;Thanks, i have i have to use other convertion&amp;nbsp;&lt;/P&gt;&lt;P&gt;| summarize FechaInicial = min(Fecha), FechaFinal = max(Fecha), by: { Identificador}&lt;BR /&gt;| fieldsAdd Duracion = (totimestamp(FechaFinal) - totimestamp(FechaInicial))&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2025 01:42:33 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-get-the-differnce-betweent-two-timestamp/m-p/290197#M2820</guid>
      <dc:creator>marusla</dc:creator>
      <dc:date>2025-11-25T01:42:33Z</dc:date>
    </item>
  </channel>
</rss>

