<?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 write a search to find the top 10 results based on a calculated field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-the-top-10-results-based-on-a/m-p/186466#M53688</link>
    <description>&lt;P&gt;I think I found a solution to the problem. &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;...| streamstats count by USER |table ID,CALCULATED_NUM,USER,count| sort by USER,-CALCULATED_NUM| where count&amp;lt;=10&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Please let me know if there is straightforward way of doing this.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:42:06 GMT</pubDate>
    <dc:creator>nibinabr</dc:creator>
    <dc:date>2020-09-28T18:42:06Z</dc:date>
    <item>
      <title>How to write a search to find the top 10 results based on a calculated field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-the-top-10-results-based-on-a/m-p/186464#M53686</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;

&lt;P&gt;I had a question &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ID       N1     N2    USER  CALCULATED_NUM
001      10     2     user_1    8
002      8      4     user_2    4
003      7      9     user_1   -2
.
.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;CALCULATED_NUM=N1-N2&lt;/P&gt;

&lt;P&gt;I need to write a search query that returns the top 10 CALCULATED_NUM by each USER.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| table ID,CALCULATED_NUM,USER| sort by USER,-CALCULATED_NUM
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;gives me all the ID's sorted by user with CALCULATED_NUM sorted in desc order, but I need only the top 10 IDs per USER.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2015 15:38:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-the-top-10-results-based-on-a/m-p/186464#M53686</guid>
      <dc:creator>nibinabr</dc:creator>
      <dc:date>2015-01-19T15:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search to find the top 10 results based on a calculated field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-the-top-10-results-based-on-a/m-p/186465#M53687</link>
      <description>&lt;P&gt;Hi nibinabr,&lt;/P&gt;

&lt;P&gt;Look at this answer &lt;A href="http://answers.splunk.com/answers/208658/how-to-limit-results-with-multiple-group-by-condit.html#answer-209608"&gt;http://answers.splunk.com/answers/208658/how-to-limit-results-with-multiple-group-by-condit.html#answer-209608&lt;/A&gt; to get an example how this can be done. &lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2015 17:07:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-the-top-10-results-based-on-a/m-p/186465#M53687</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-01-19T17:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search to find the top 10 results based on a calculated field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-the-top-10-results-based-on-a/m-p/186466#M53688</link>
      <description>&lt;P&gt;I think I found a solution to the problem. &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;...| streamstats count by USER |table ID,CALCULATED_NUM,USER,count| sort by USER,-CALCULATED_NUM| where count&amp;lt;=10&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Please let me know if there is straightforward way of doing this.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:42:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-the-top-10-results-based-on-a/m-p/186466#M53688</guid>
      <dc:creator>nibinabr</dc:creator>
      <dc:date>2020-09-28T18:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search to find the top 10 results based on a calculated field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-the-top-10-results-based-on-a/m-p/186467#M53689</link>
      <description>&lt;P&gt;Thanks MuS, &lt;/P&gt;

&lt;P&gt;I found a similar post that helped me get into the solution.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/148651/how-to-get-top-2-mb-users-per-website.html"&gt;http://answers.splunk.com/answers/148651/how-to-get-top-2-mb-users-per-website.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2015 17:10:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-find-the-top-10-results-based-on-a/m-p/186467#M53689</guid>
      <dc:creator>nibinabr</dc:creator>
      <dc:date>2015-01-19T17:10:58Z</dc:date>
    </item>
  </channel>
</rss>

