<?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: Splunk values() returns swapped counts in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594604#M206952</link>
    <description>&lt;P&gt;No problem&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt; We all started out the same - welcome to your journey with Splunk!&lt;/P&gt;</description>
    <pubDate>Thu, 21 Apr 2022 08:22:27 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-04-21T08:22:27Z</dc:date>
    <item>
      <title>Why does Splunk values() return swapped counts?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594600#M206949</link>
      <description>&lt;P&gt;I want to use the values() function because I want to group by fields. If I just use count by I get the correct result but it doesn't look nice. If I use the values function the counts get swapped.&lt;BR /&gt;&lt;BR /&gt;this is how count by returns the results:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Function&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; Status&amp;nbsp; |&amp;nbsp; count&lt;BR /&gt;Authentication&amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp;Pass&amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; 10&lt;BR /&gt;Authentication&amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp;Fail&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;BR /&gt;&lt;BR /&gt;this is how the values() returns the results:&lt;BR /&gt;&lt;BR /&gt;Function&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; Status&amp;nbsp; |&amp;nbsp; count&lt;BR /&gt;Authentication&amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp;Pass&amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; 3&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; &amp;nbsp;Fail&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp;10&lt;BR /&gt;&lt;BR /&gt;Here is the count by search:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;| stats count by Function,&amp;nbsp; Status&lt;BR /&gt;| table Function, Status, count&lt;BR /&gt;&lt;BR /&gt;Here is the values search:&lt;BR /&gt;| stats count by Function,&amp;nbsp; Status&lt;BR /&gt;| stats values(Status) as Status, values(count) as Count by Function&lt;BR /&gt;| table Function, Status, Count&lt;BR /&gt;&lt;BR /&gt;So my question is how do I group by Function while getting the correct counts for the status.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 14:41:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594600#M206949</guid>
      <dc:creator>Zoblou</dc:creator>
      <dc:date>2022-04-21T14:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk values() returns swapped counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594602#M206950</link>
      <description>&lt;P&gt;Firstly, it is unlikely that values() will return the status and count values in the order you show because values() will sort them lexicographically so Fail would be before Pass and 10 would be before 3&lt;/P&gt;&lt;P&gt;If you want to preserve the order use list() instead of values()&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 08:18:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594602#M206950</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-21T08:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk values() returns swapped counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594603#M206951</link>
      <description>&lt;P&gt;Thank you so much, as you can tell I am new and still learning. But thank you for the help.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 08:20:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594603#M206951</guid>
      <dc:creator>Zoblou</dc:creator>
      <dc:date>2022-04-21T08:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk values() returns swapped counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594604#M206952</link>
      <description>&lt;P&gt;No problem&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt; We all started out the same - welcome to your journey with Splunk!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 08:22:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594604#M206952</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-21T08:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk values() returns swapped counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594605#M206953</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245097"&gt;@Zoblou&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the problem is that the values opetion sort data for each one so the values will not correspond,&lt;/P&gt;&lt;P&gt;the only way is to aggregate two fields using eval and then divide after grouping, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;your_search
| stats count by Function,  Status
| eval column=Status."|".count
| stats values(column) AS column by Function
| rex field=column "^(?&amp;lt;Status&amp;gt;[^\|]+)\|(?&amp;lt;count&amp;gt;.+)"
| table Function Status count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 08:22:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-Splunk-values-return-swapped-counts/m-p/594605#M206953</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-04-21T08:22:41Z</dc:date>
    </item>
  </channel>
</rss>

