<?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: How to average fields together across multiple columns grouped together by the field name containing a specific string ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-average-fields-together-across-multiple-columns-grouped/m-p/385433#M112562</link>
    <description>&lt;P&gt;This is a neat and clean approach to solve the problem I was having. Much easier to understand this way versus the overly convoluted field extraction I had setup in my search. Thanks again for the help. &lt;/P&gt;</description>
    <pubDate>Thu, 15 Nov 2018 02:16:24 GMT</pubDate>
    <dc:creator>l1bertyx</dc:creator>
    <dc:date>2018-11-15T02:16:24Z</dc:date>
    <item>
      <title>How to average fields together across multiple columns grouped together by the field name containing a specific string ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-average-fields-together-across-multiple-columns-grouped/m-p/385431#M112560</link>
      <description>&lt;P&gt;I am trying to average fields together across multiple columns based on a specific string (A_Field and B_Field)&lt;/P&gt;

&lt;P&gt;For Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  T1A_Field  T1B_Field  T2A_Field  T2B_Field .......T10A_Field  T10B_Field
1. 2            3          2          6                 5           3
2. 3            4          3          5                 3           7
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; A_Field  B_Field
1. 3        4
2. 3        5.33
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can't seem to wrap my head around how to average the fields together across columns with the condition that the field name contains either A_Field or B_Field. I would type it out individually to get the overall group average, but there are a larger number of fields than what was listed above and it becomes too inefficient. Apologies, as I am still in the learning process with Splunk.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:59:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-average-fields-together-across-multiple-columns-grouped/m-p/385431#M112560</guid>
      <dc:creator>l1bertyx</dc:creator>
      <dc:date>2020-09-29T21:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to average fields together across multiple columns grouped together by the field name containing a specific string ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-average-fields-together-across-multiple-columns-grouped/m-p/385432#M112561</link>
      <description>&lt;P&gt;This is a great case for foreach:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | foreach A_Field B_Field [eval sum_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = 0, count_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = 0]
| foreach  *A_Field [eval sum_A_Field = sum_A_Field + '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;', count_A_Field = count_A_Field + 1]
| foreach  *B_Field [eval sum_B_Field = sum_B_Field + '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;', count_B_Field = count_B_Field + 1]
| foreach A_Field B_Field [eval avg_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = sum_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; / count_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Nov 2018 01:58:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-average-fields-together-across-multiple-columns-grouped/m-p/385432#M112561</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-11-15T01:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to average fields together across multiple columns grouped together by the field name containing a specific string ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-average-fields-together-across-multiple-columns-grouped/m-p/385433#M112562</link>
      <description>&lt;P&gt;This is a neat and clean approach to solve the problem I was having. Much easier to understand this way versus the overly convoluted field extraction I had setup in my search. Thanks again for the help. &lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 02:16:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-average-fields-together-across-multiple-columns-grouped/m-p/385433#M112562</guid>
      <dc:creator>l1bertyx</dc:creator>
      <dc:date>2018-11-15T02:16:24Z</dc:date>
    </item>
  </channel>
</rss>

