<?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: Nested Loop or a Sub-search in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Nested-Loop-or-a-Sub-search/m-p/468083#M80591</link>
    <description>&lt;P&gt;Thank you so much Giuseppe!  That is exactly what I was looking for...knew it had to be something simple.  Thanks again! &lt;/P&gt;</description>
    <pubDate>Wed, 04 Sep 2019 14:51:38 GMT</pubDate>
    <dc:creator>amanno</dc:creator>
    <dc:date>2019-09-04T14:51:38Z</dc:date>
    <item>
      <title>Nested Loop or a Sub-search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Nested-Loop-or-a-Sub-search/m-p/468081#M80589</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;I know there has to be a straightforward way to do this in SPL just can't figure out which to use.&lt;/P&gt;

&lt;P&gt;I have a data set like so (CSV format):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Trial Id, Size, Result, Value
1, 64, Passed, 15000
1, 64, Passed, 14957
1, 64, Failed, 15230
1, 258, Passed, 7000
1, 258, Failed, 7500
1, 258, Passed, 6950
1, 315, Failed, 2300
1, 315, Failed, 2200
1, 315, Passed, 2100

2, 64, Passed, 15095
2, 64, Passed, 14777
2, 64, Failed, 15690
2, 258, Passed, 7100
2, 258, Failed, 7250
2, 258, Passed, 6350
2, 315, Failed, 2200
2, 315, Failed, 2000
2, 315, Passed, 2195

3, 64, Passed, 15020
3, 64, Passed, 14990
3, 64, Failed, 15245
3, 258, Passed, 7012
3, 258, Failed, 7504
3, 258, Passed, 6951
3, 315, Failed, 2309
3, 315, Failed, 2211
3, 315, Passed, 2199
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I need to compute the average of all max values per size per Trial ID (for only the ones that have Result=Passed)&lt;/P&gt;

&lt;P&gt;This is what I have so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" Result=Passed Size=64 | stats max(Value) as max_value by "Trial Id" | stats avg(max_value) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which does give me the value I am looking for but only for the "Size=64" case.  How do I iterate over all the different sizes, while computing the "avg(max_value)" for each of the different sizes?  I then plan to chart the average max size over the "size".&lt;/P&gt;

&lt;P&gt;Thanks for any help!  &lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 14:36:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Nested-Loop-or-a-Sub-search/m-p/468081#M80589</guid>
      <dc:creator>amanno</dc:creator>
      <dc:date>2019-09-04T14:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Loop or a Sub-search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Nested-Loop-or-a-Sub-search/m-p/468082#M80590</link>
      <description>&lt;P&gt;Hi amanno,&lt;BR /&gt;
did you tried to insert also Size in stats clauses?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" Result=Passed | stats max(Value) as max_value by "Trial Id" Size | stats avg(max_value)  By Size
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 14:41:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Nested-Loop-or-a-Sub-search/m-p/468082#M80590</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-09-04T14:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Loop or a Sub-search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Nested-Loop-or-a-Sub-search/m-p/468083#M80591</link>
      <description>&lt;P&gt;Thank you so much Giuseppe!  That is exactly what I was looking for...knew it had to be something simple.  Thanks again! &lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 14:51:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Nested-Loop-or-a-Sub-search/m-p/468083#M80591</guid>
      <dc:creator>amanno</dc:creator>
      <dc:date>2019-09-04T14:51:38Z</dc:date>
    </item>
  </channel>
</rss>

