<?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: Stats Max count for field values over time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153328#M43020</link>
    <description>&lt;P&gt;Just change the sort order before the dedup.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup test.csv | convert mktime(_time) timeformat="%d/%m/%Y"
| convert ctime(_time) AS Date timeformat="%d/%m/%Y"
| stats sum(count) AS # by Date Product
| stats max(#) AS # by Date Product
| sort Product - #
| dedup Product
| sort Date Product
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date    Product #
21/10/2014  Ptype1  21
21/10/2014  Ptype4  6
22/10/2014  Ptype5  26
23/10/2014  Ptype2  8
23/10/2014  Ptype3  52
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 19 Dec 2014 12:22:06 GMT</pubDate>
    <dc:creator>pedromvieira</dc:creator>
    <dc:date>2014-12-19T12:22:06Z</dc:date>
    <item>
      <title>Stats Max count for field values over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153323#M43015</link>
      <description>&lt;P&gt;I have the following data&lt;/P&gt;

&lt;P&gt;_time   Product     count&lt;BR /&gt;
21/10/2014  Ptype1  21&lt;BR /&gt;
21/10/2014  Ptype2  3&lt;BR /&gt;
21/10/2014  Ptype3  43&lt;BR /&gt;
21/10/2014  Ptype4  6&lt;BR /&gt;
21/10/2014  Ptype5  17&lt;BR /&gt;
22/10/2014  Ptype1  18&lt;BR /&gt;
22/10/2014  Ptype3  23&lt;BR /&gt;
22/10/2014  Ptype5  26&lt;BR /&gt;
23/10/2014  Ptype1  14&lt;BR /&gt;
23/10/2014  Ptype2  8&lt;BR /&gt;
23/10/2014  Ptype3  52&lt;BR /&gt;
23/10/2014  Ptype4  4&lt;BR /&gt;
23/10/2014  Ptype5  1&lt;/P&gt;

&lt;P&gt;I would like to search over a period of time and show the max count by Product. with results displayed below.&lt;/P&gt;

&lt;P&gt;_time   Product     count&lt;BR /&gt;
21/10/2014  Ptype1  21&lt;BR /&gt;
22/10/2014  Ptype5  26&lt;BR /&gt;
23/10/2014  Ptype2  8&lt;BR /&gt;
23/10/2014  Ptype3  52&lt;BR /&gt;
23/10/2014  Ptype4  4&lt;/P&gt;

&lt;P&gt;Is this possible?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2014 12:37:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153323#M43015</guid>
      <dc:creator>DanielFordWA</dc:creator>
      <dc:date>2014-12-18T12:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Max count for field values over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153324#M43016</link>
      <description>&lt;P&gt;You could use timechart or stats to achieve that.&lt;BR /&gt;
Just replace my first line with your base search.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;timechart&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.1/SearchReference/Timechart" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.1/SearchReference/Timechart&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;| inputlookup test.csv | convert mktime(_time) timeformat="%d/%m/%Y"&lt;BR /&gt;
| timechart useother=f usenull=f cont=f span=1d sum(count) by Product&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;stats&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.1/SearchReference/Stats" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.1/SearchReference/Stats&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;| inputlookup test.csv | convert mktime(_time) timeformat="%d/%m/%Y"&lt;BR /&gt;
| convert ctime(_time) AS Date timeformat="%d/%m/%Y"&lt;BR /&gt;
| stats sum(count) by Date Product&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:28:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153324#M43016</guid>
      <dc:creator>pedromvieira</dc:creator>
      <dc:date>2020-09-28T18:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Max count for field values over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153325#M43017</link>
      <description>&lt;P&gt;Thanks for the reply. I cant get this working though.&lt;/P&gt;

&lt;P&gt;Just to calirfy. If I search over the month of december, I would expect the below result.&lt;/P&gt;

&lt;P&gt;21/10/2014 Ptype1 21&lt;BR /&gt;
22/10/2014 Ptype5 26&lt;BR /&gt;
23/10/2014 Ptype2 8&lt;BR /&gt;
23/10/2014 Ptype3 52&lt;BR /&gt;
23/10/2014 Ptype4 4&lt;/P&gt;

&lt;P&gt;At the moment I am still gettting data for every day. The requirement is to get the max count by product over the time range and display what day that max occured on.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2014 14:14:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153325#M43017</guid>
      <dc:creator>DanielFordWA</dc:creator>
      <dc:date>2014-12-18T14:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Max count for field values over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153326#M43018</link>
      <description>&lt;P&gt;Try dedup. It will showcase the first occurrence.&lt;BR /&gt;
Replace the first line with your base search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup test.csv | convert mktime(_time) timeformat="%d/%m/%Y"
| convert ctime(_time) AS Date timeformat="%d/%m/%Y"
| stats sum(count) AS # by Date Product
| stats max(#) AS # by Date Product
| sort Date - #
| dedup Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date    Product #
21/10/2014  Ptype3  43
22/10/2014  Ptype5  26
23/10/2014  Ptype3  52
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Dec 2014 16:17:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153326#M43018</guid>
      <dc:creator>pedromvieira</dc:creator>
      <dc:date>2014-12-18T16:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Max count for field values over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153327#M43019</link>
      <description>&lt;P&gt;Thanks, during the time range the higest count for Ptype2 and Ptype4 are also on the 23/10/2014, so I would want the results to be &lt;/P&gt;

&lt;P&gt;21/10/2014 Ptype1 21&lt;BR /&gt;
22/10/2014 Ptype5 26&lt;BR /&gt;
23/10/2014 Ptype2 8&lt;BR /&gt;
23/10/2014 Ptype3 52&lt;BR /&gt;
23/10/2014 Ptype4 4&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 10:15:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153327#M43019</guid>
      <dc:creator>DanielFordWA</dc:creator>
      <dc:date>2014-12-19T10:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Max count for field values over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153328#M43020</link>
      <description>&lt;P&gt;Just change the sort order before the dedup.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup test.csv | convert mktime(_time) timeformat="%d/%m/%Y"
| convert ctime(_time) AS Date timeformat="%d/%m/%Y"
| stats sum(count) AS # by Date Product
| stats max(#) AS # by Date Product
| sort Product - #
| dedup Product
| sort Date Product
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date    Product #
21/10/2014  Ptype1  21
21/10/2014  Ptype4  6
22/10/2014  Ptype5  26
23/10/2014  Ptype2  8
23/10/2014  Ptype3  52
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Dec 2014 12:22:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153328#M43020</guid>
      <dc:creator>pedromvieira</dc:creator>
      <dc:date>2014-12-19T12:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Max count for field values over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153329#M43021</link>
      <description>&lt;P&gt;Works like a charm, Thanks very much for the help!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 13:38:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Max-count-for-field-values-over-time/m-p/153329#M43021</guid>
      <dc:creator>DanielFordWA</dc:creator>
      <dc:date>2014-12-19T13:38:11Z</dc:date>
    </item>
  </channel>
</rss>

