<?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 compare the values from same fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-the-values-from-same-fields/m-p/615720#M213964</link>
    <description>&lt;P&gt;The following will work in Splunk 9 with the new multivalue mode in &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Foreach" target="_blank" rel="noopener"&gt;foreach&lt;/A&gt;.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats values(field_1) as field_1
| foreach field_1 mode=multivalue
    [eval new_field = mvappend(new_field, tostring(if(isnull(new_field), 0, max(new_field)) + &amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;))]
| eval zip = mvzip(field_1, new_field, ":")
| mvexpand zip
| eval zip = split(zip, ":")
| eval field_1 = mvindex(zip, 0), new_field = mvindex(zip, 1)&lt;/LI-CODE&gt;&lt;P&gt;(If you need to access other fields in original search, modify "group by" clause or use eventstats as opposed to stats.)&lt;/P&gt;&lt;P&gt;I totally thought this could be solved with mvmap (no need for Splunk 9), but I couldn't get that to work.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2022 20:35:31 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2022-10-03T20:35:31Z</dc:date>
    <item>
      <title>How to compare the values from same fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-the-values-from-same-fields/m-p/615691#M213958</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saurabh_ha_0-1664820432808.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21840i0D68676276293155/image-size/medium?v=v2&amp;amp;px=400" role="button" title="saurabh_ha_0-1664820432808.png" alt="saurabh_ha_0-1664820432808.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I want to create the new_field when other values of field_1 is less than of first value.&lt;BR /&gt;Here in below example as 23 greater than other values then do sum of all which is 44.&lt;BR /&gt;for 10 is the smallest then its result is 10&lt;BR /&gt;for 11 there is one more value is less which is 10 then do sum with 10 then result is 21&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 18:24:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-the-values-from-same-fields/m-p/615691#M213958</guid>
      <dc:creator>saurabh_ha</dc:creator>
      <dc:date>2022-10-03T18:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare the values from same fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-the-values-from-same-fields/m-p/615720#M213964</link>
      <description>&lt;P&gt;The following will work in Splunk 9 with the new multivalue mode in &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Foreach" target="_blank" rel="noopener"&gt;foreach&lt;/A&gt;.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats values(field_1) as field_1
| foreach field_1 mode=multivalue
    [eval new_field = mvappend(new_field, tostring(if(isnull(new_field), 0, max(new_field)) + &amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;))]
| eval zip = mvzip(field_1, new_field, ":")
| mvexpand zip
| eval zip = split(zip, ":")
| eval field_1 = mvindex(zip, 0), new_field = mvindex(zip, 1)&lt;/LI-CODE&gt;&lt;P&gt;(If you need to access other fields in original search, modify "group by" clause or use eventstats as opposed to stats.)&lt;/P&gt;&lt;P&gt;I totally thought this could be solved with mvmap (no need for Splunk 9), but I couldn't get that to work.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 20:35:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-the-values-from-same-fields/m-p/615720#M213964</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-03T20:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare the values from same fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-the-values-from-same-fields/m-p/615775#M213983</link>
      <description>&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;It is working as expected&amp;nbsp; in our UAT as you mentioned&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 08:54:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-the-values-from-same-fields/m-p/615775#M213983</guid>
      <dc:creator>saurabh_ha</dc:creator>
      <dc:date>2022-10-04T08:54:20Z</dc:date>
    </item>
  </channel>
</rss>

