<?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 get full row based on max in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-full-row-based-on-max/m-p/333488#M99184</link>
    <description>&lt;P&gt;Great, it works!&lt;/P&gt;

&lt;P&gt;The second requirement was related to the need to avoid multivalue fields in the following case&lt;/P&gt;

&lt;P&gt;CI        ReqWeekAva   Cluster_Ava_Code&lt;BR /&gt;
App1        10                          CAC1&lt;BR /&gt;
App1         40                         CAC2&lt;BR /&gt;
App1        30                          CAC3&lt;BR /&gt;
App1        40                          CAC2&lt;/P&gt;

&lt;P&gt;I mean avoid output like&lt;/P&gt;

&lt;P&gt;App1   40    CAC1&lt;BR /&gt;
             40   CAC1&lt;/P&gt;

&lt;P&gt;But your solution it's fine, so no issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 17:50:06 GMT</pubDate>
    <dc:creator>CarmineCalo</dc:creator>
    <dc:date>2020-09-29T17:50:06Z</dc:date>
    <item>
      <title>How to get full row based on max</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-full-row-based-on-max/m-p/333486#M99182</link>
      <description>&lt;P&gt;Splunkers!&lt;/P&gt;

&lt;P&gt;I need to solve this problem.&lt;BR /&gt;
Basically, starting from a Service Catalogue (having the same AppID linked to more Business Services having potentially different Operational WIndows), i need to select the max Operational Window required (both in term of number and ID).&lt;/P&gt;

&lt;P&gt;Starting from an inputlookup (so no events as input) i need to select a full row (all columns) based on the max value in a specific column.&lt;/P&gt;

&lt;P&gt;Current code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup DOM_ServiceCatalogue
| lookup AMAP_ReqAvailability Cluster_Availability as PrimaryWindows OUTPUTNEW ReqWeeklyAvailability as ReqWeekAva, Cluster_Ava_Code as Cluster_Ava_Code

| stats max(ReqWeekAva) as ReqWeekAva, values(Cluster_Ava_Code) by CI
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But values function creates a MV fields, while i just need the "Cluster_Ava_Code" corresponding to the max value selected by stats function.&lt;BR /&gt;
Additionally, It might happen to have multiple rows in the Service Catalogue having the same max value for different services supported by the same AppID....&lt;/P&gt;

&lt;P&gt;How can i do it?&lt;/P&gt;

&lt;P&gt;Tks!&lt;BR /&gt;
Carmine&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:50:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-full-row-based-on-max/m-p/333486#M99182</guid>
      <dc:creator>CarmineCalo</dc:creator>
      <dc:date>2020-09-29T17:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get full row based on max</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-full-row-based-on-max/m-p/333487#M99183</link>
      <description>&lt;P&gt;Instead of using &lt;CODE&gt;stats&lt;/CODE&gt; on line 4, how about instead adding a field called &lt;CODE&gt;max_ReqWeekAva&lt;/CODE&gt; to every event, which tracks the max value of &lt;CODE&gt;ReqWeekAva&lt;/CODE&gt; by &lt;CODE&gt;CI&lt;/CODE&gt; value, and then retaining only the events where &lt;CODE&gt;ReqWeekAva&lt;/CODE&gt;=&lt;CODE&gt;max_ReqWeekAva&lt;/CODE&gt;? That would look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup DOM_ServiceCatalogue
| lookup AMAP_ReqAvailability Cluster_Availability as PrimaryWindows OUTPUTNEW ReqWeeklyAvailability as ReqWeekAva, Cluster_Ava_Code as Cluster_Ava_Code
| eventstats max(ReqWeekAva) as max_ReqWeekAva by CI
| where max_ReqWeekAva=ReqWeekAva
| stats max(ReqWeekAva) AS ReqWeekAva, max(Cluster_Ava_Code) AS Cluster_AVA_Code BY CI
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't quite understand the second requirement in your post: "Additionally, It might happen to have multiple rows in the Service Catalogue having the same max value for different services supported by the same AppID...." Can you explain that part further?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 19:32:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-full-row-based-on-max/m-p/333487#M99183</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-01-24T19:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get full row based on max</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-full-row-based-on-max/m-p/333488#M99184</link>
      <description>&lt;P&gt;Great, it works!&lt;/P&gt;

&lt;P&gt;The second requirement was related to the need to avoid multivalue fields in the following case&lt;/P&gt;

&lt;P&gt;CI        ReqWeekAva   Cluster_Ava_Code&lt;BR /&gt;
App1        10                          CAC1&lt;BR /&gt;
App1         40                         CAC2&lt;BR /&gt;
App1        30                          CAC3&lt;BR /&gt;
App1        40                          CAC2&lt;/P&gt;

&lt;P&gt;I mean avoid output like&lt;/P&gt;

&lt;P&gt;App1   40    CAC1&lt;BR /&gt;
             40   CAC1&lt;/P&gt;

&lt;P&gt;But your solution it's fine, so no issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:50:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-full-row-based-on-max/m-p/333488#M99184</guid>
      <dc:creator>CarmineCalo</dc:creator>
      <dc:date>2020-09-29T17:50:06Z</dc:date>
    </item>
  </channel>
</rss>

