<?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 do I give same rank for same score? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668931#M229450</link>
    <description>&lt;LI-CODE lang="markup"&gt;| streamstats count as Rank
| streamstats window=2 range(Score) as range
| eval Rank=if(Rank=1 OR range != 0, Rank, null())
| filldown Rank&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 16 Nov 2023 22:24:17 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-11-16T22:24:17Z</dc:date>
    <item>
      <title>How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668918#M229445</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;How do I give same rank for same score?&lt;BR /&gt;Student d and e has the same score of 73, thus they both Rank 4, but student f has Rank 6. Rank 5 is skipped because Student d and e has the same score.&amp;nbsp;&lt;BR /&gt;Thank you for your help&lt;BR /&gt;&lt;BR /&gt;Expected result:&lt;/P&gt;&lt;TABLE border="0" width="192" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="64" height="19"&gt;&lt;STRONG&gt;Student&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="64"&gt;&lt;STRONG&gt;Score&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="64"&gt;&lt;STRONG&gt;Rank&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;a&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;b&lt;/TD&gt;&lt;TD&gt;95&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;c&lt;/TD&gt;&lt;TD&gt;84&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;&lt;STRONG&gt;d&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;73&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;&lt;STRONG&gt;e&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;73&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;f&lt;/TD&gt;&lt;TD&gt;54&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;g&lt;/TD&gt;&lt;TD&gt;43&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;h&lt;/TD&gt;&lt;TD&gt;37&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;i&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="19"&gt;j&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I figured out so far, but i won't take into consideration of same Score&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="Student, Score  
a,100 
b,95
c,84
d,73
e,73
f,54
g,43
h,37
i,22
j,12"
| streamstats count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 02:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668918#M229445</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-11-17T02:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668929#M229448</link>
      <description>&lt;P&gt;From the top of my head. Untested, might need some tweaking.&lt;/P&gt;&lt;PRE&gt;| stats values(App) as App count by Score&lt;BR /&gt;| streamstats sum(count) as rank&lt;BR /&gt;| mvexpand App&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Nov 2023 22:16:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668929#M229448</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-11-16T22:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668931#M229450</link>
      <description>&lt;LI-CODE lang="markup"&gt;| streamstats count as Rank
| streamstats window=2 range(Score) as range
| eval Rank=if(Rank=1 OR range != 0, Rank, null())
| filldown Rank&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 Nov 2023 22:24:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668931#M229450</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-11-16T22:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668938#M229454</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254242"&gt;@LearningGuy&lt;/a&gt;&amp;nbsp;as I said in the other post - you can probably solve that problem&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and as usual,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;comes up with the perfect elegant solution!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 01:10:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668938#M229454</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-11-17T01:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668944#M229458</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;I tried your suggestion and it worked. I accepted this solution and will try on real data.&lt;BR /&gt;1)&amp;nbsp; Can you explain what this eval for?&lt;BR /&gt;It looks like if range is 0, you replace the pos with NULL and fill down with previous value, except for position one?&lt;/P&gt;&lt;PRE&gt;| eval Rank=if(Rank=1 OR range != 0, Rank, null())&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;2) Would it be possible to&amp;nbsp;use only 1 streamstats instead of 2 streamstats?&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you so much for your help&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 03:13:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668944#M229458</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-11-17T03:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668975#M229469</link>
      <description>&lt;P&gt;1) If the Rank is 1, it needs to remain 1, or if there is a difference in values, the rank needs to remain the same (as it is already correct), otherwise, if there is no difference between the current and previous value, the rank should be the same as the previous rank. By setting it to null(), when the filldown happens, the rank is copied down to all positions with the same rank.&lt;/P&gt;&lt;P&gt;2) It is not possible to do with just one streamstats because the first streamstats has to operate over the whole pipeline, whereas the second has to operate with a (rolling) window of two events.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 09:42:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668975#M229469</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-11-17T09:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668976#M229470</link>
      <description>&lt;P&gt;2) Actually you can get away with just one streamstats. Replace the other one with autoregress. (But yes, it will still give you two separate passes across your results)&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 09:53:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668976#M229470</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-11-17T09:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668985#M229472</link>
      <description>&lt;P&gt;Autoregress is the same as&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats window=2 current=f last(Score) as Score_p1&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 17 Nov 2023 10:44:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668985#M229472</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-11-17T10:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668999#M229474</link>
      <description>&lt;P&gt;Sure, it is. But it's formally a different command &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 12:21:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/668999#M229474</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-11-17T12:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/699433#M237435</link>
      <description>&lt;P&gt;If you want to avoid using 2 streamstats you shall try this way,&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| streamstats count as Rank
| delta Score as Diff
| eval Rank=if(Diff=0,Rank-1,Rank)
| fields - Diff&lt;/LI-CODE&gt;
&lt;P&gt;And with 2 streamstats you shall try this so to avoid 1 extra filldown command,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| streamstats count as Rank
| streamstats window=2 range(Score) as range
| eval Rank=if(Rank=1 OR range != 0, Rank, Rank-1)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 18 Sep 2024 17:10:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/699433#M237435</guid>
      <dc:creator>shalomsuresh</dc:creator>
      <dc:date>2024-09-18T17:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/699435#M237436</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/180019"&gt;@shalomsuresh&lt;/a&gt;&amp;nbsp;These solutions don't work if there are more than 3 with the same score, e.g. if "f" had a score of 73 as well.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 16:23:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/699435#M237436</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-09-18T16:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I give same rank for same score?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/699533#M237461</link>
      <description>&lt;P&gt;Yep you are right, I wasn't thinking about that. We can still use the following,&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| streamstats count as Rank
| delta Score as Diff
| eval Rank=if(Diff=0,null,Rank)
| filldown
| fields - Diff&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 Sep 2024 14:11:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-give-same-rank-for-same-score/m-p/699533#M237461</guid>
      <dc:creator>shalomsuresh</dc:creator>
      <dc:date>2024-09-19T14:11:24Z</dc:date>
    </item>
  </channel>
</rss>

