<?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: Calculation of Percentage of problems with &amp;quot;Summarize&amp;quot; in DQL in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Calculation-of-Percentage-of-problems-with-quot-Summarize-quot/m-p/249566#M1024</link>
    <description>&lt;P&gt;It is possible to approach in 2 way to the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. "Ask again"&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch events
| filter event.kind == "DAVIS_PROBLEM"
| filter event.status_transition == "CREATED"
| summarize a = count(), by:{event.category, event.kind}
| lookup [
  fetch events
  | filter event.kind == "DAVIS_PROBLEM"
  | filter event.status_transition == "CREATED"
  | summarize total = count(), by:{event.kind}
], sourceField:event.kind, lookupField:event.kind, fields:{total}
| fields event.category, a, ap=100*a/total&lt;/LI-CODE&gt;&lt;P&gt;Using &lt;EM&gt;&lt;STRONG&gt;lookup&lt;/STRONG&gt; &lt;/EM&gt;command you can add (calculated by another query) total count to each of of rows. Then you you can divide particular count by total number of events. Lookup command requires joining fields to be specified. I used event.kind on both sided as it will have only one value for this query and no "fake key" needs to be produced.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1719849063258.png" style="width: 678px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20893iC3041D32D6871314/image-dimensions/678x629?v=v2" width="678" height="629" role="button" title="krzysztof_hoja_0-1719849063258.png" alt="krzysztof_hoja_0-1719849063258.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1. "summarize + expand"&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch events
| filter event.kind == "DAVIS_PROBLEM"
| filter event.status_transition == "CREATED"
| summarize a = count(), by:{event.category}
| summarize { total=sum(a), d=collectArray(record(event.category, a))}
| expand d
| fields event.category=d[event.category], a=d[a], ap=100*d[a]/total&lt;/LI-CODE&gt;&lt;P&gt;After a basic query additional summarization needs to happen. This way we can calculate total (sum of individual counts). In order not to lose details, we need to collect components in arrays of pairs (event.category and a). After summarization we can bring back original row count using &lt;EM&gt;&lt;STRONG&gt;expand&lt;/STRONG&gt; &lt;/EM&gt;command after which each row will have total field ready to calculate percentage.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_1-1719849337936.png" style="width: 662px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20894i862B45900E0A2DD4/image-dimensions/662x517?v=v2" width="662" height="517" role="button" title="krzysztof_hoja_1-1719849337936.png" alt="krzysztof_hoja_1-1719849337936.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2024 15:56:35 GMT</pubDate>
    <dc:creator>krzysztof_hoja</dc:creator>
    <dc:date>2024-07-01T15:56:35Z</dc:date>
    <item>
      <title>Calculation of Percentage of problems with "Summarize" in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Calculation-of-Percentage-of-problems-with-quot-Summarize-quot/m-p/249461#M1023</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Hello, maybe you could help me, I have a query that counts the total events by category "event.category", when using the summarize command I cannot calculate the total events in this way to obtain the percentage it represents in an additional column, EX: &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;%=100*(count per Category/Total)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch events//, from:now()
| filter event.kind == "DAVIS_PROBLEM"
| fieldsAdd dt.entity.service= affected_entity_ids[0]
| fieldsAdd dt.entity.service.name = entityName(dt.entity.service)
| filter event.status_transition == "CREATED"
| summarize a = count(), by:{event.category}&lt;/LI-CODE&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="JhonU_0-1719772882243.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20842iFE1AC9A7C23F531D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JhonU_0-1719772882243.png" alt="JhonU_0-1719772882243.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jun 2024 18:45:31 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Calculation-of-Percentage-of-problems-with-quot-Summarize-quot/m-p/249461#M1023</guid>
      <dc:creator>JhonU</dc:creator>
      <dc:date>2024-06-30T18:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of Percentage of problems with "Summarize" in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Calculation-of-Percentage-of-problems-with-quot-Summarize-quot/m-p/249566#M1024</link>
      <description>&lt;P&gt;It is possible to approach in 2 way to the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. "Ask again"&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch events
| filter event.kind == "DAVIS_PROBLEM"
| filter event.status_transition == "CREATED"
| summarize a = count(), by:{event.category, event.kind}
| lookup [
  fetch events
  | filter event.kind == "DAVIS_PROBLEM"
  | filter event.status_transition == "CREATED"
  | summarize total = count(), by:{event.kind}
], sourceField:event.kind, lookupField:event.kind, fields:{total}
| fields event.category, a, ap=100*a/total&lt;/LI-CODE&gt;&lt;P&gt;Using &lt;EM&gt;&lt;STRONG&gt;lookup&lt;/STRONG&gt; &lt;/EM&gt;command you can add (calculated by another query) total count to each of of rows. Then you you can divide particular count by total number of events. Lookup command requires joining fields to be specified. I used event.kind on both sided as it will have only one value for this query and no "fake key" needs to be produced.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1719849063258.png" style="width: 678px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20893iC3041D32D6871314/image-dimensions/678x629?v=v2" width="678" height="629" role="button" title="krzysztof_hoja_0-1719849063258.png" alt="krzysztof_hoja_0-1719849063258.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1. "summarize + expand"&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch events
| filter event.kind == "DAVIS_PROBLEM"
| filter event.status_transition == "CREATED"
| summarize a = count(), by:{event.category}
| summarize { total=sum(a), d=collectArray(record(event.category, a))}
| expand d
| fields event.category=d[event.category], a=d[a], ap=100*d[a]/total&lt;/LI-CODE&gt;&lt;P&gt;After a basic query additional summarization needs to happen. This way we can calculate total (sum of individual counts). In order not to lose details, we need to collect components in arrays of pairs (event.category and a). After summarization we can bring back original row count using &lt;EM&gt;&lt;STRONG&gt;expand&lt;/STRONG&gt; &lt;/EM&gt;command after which each row will have total field ready to calculate percentage.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_1-1719849337936.png" style="width: 662px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20894i862B45900E0A2DD4/image-dimensions/662x517?v=v2" width="662" height="517" role="button" title="krzysztof_hoja_1-1719849337936.png" alt="krzysztof_hoja_1-1719849337936.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 15:56:35 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Calculation-of-Percentage-of-problems-with-quot-Summarize-quot/m-p/249566#M1024</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-07-01T15:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of Percentage of problems with "Summarize" in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Calculation-of-Percentage-of-problems-with-quot-Summarize-quot/m-p/274430#M1900</link>
      <description>&lt;P&gt;Hi Kris,&lt;/P&gt;&lt;P&gt;We are trying to do a similar thing, only using Log data.&amp;nbsp; From a query cost perspective, would the summarize and expand option be "cheaper", as we don't have to run a subquery?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Aaron&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2025 14:48:28 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Calculation-of-Percentage-of-problems-with-quot-Summarize-quot/m-p/274430#M1900</guid>
      <dc:creator>Aaron_L</dc:creator>
      <dc:date>2025-04-04T14:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of Percentage of problems with "Summarize" in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Calculation-of-Percentage-of-problems-with-quot-Summarize-quot/m-p/298933#M3326</link>
      <description>&lt;P&gt;Yes!&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2026 11:58:48 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Calculation-of-Percentage-of-problems-with-quot-Summarize-quot/m-p/298933#M3326</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2026-05-04T11:58:48Z</dc:date>
    </item>
  </channel>
</rss>

