<?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 How to rearrange table by values in a column in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333725#M99232</link>
    <description>&lt;P&gt;So I have the following data as output statistics from a search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;User      Group         Number
Andy          A            123
Andy          B            123
Andy          C            123
Bob           A            123
Bob           B            123
Cam           A            123
Cam           B            123
Cam           C            123
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I rearrange it so that it becomes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;User         A         B        C
Andy       123       123      123
Bob        123       123        0
Cam        123       123      123
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, what is this rearranging called?&lt;/P&gt;</description>
    <pubDate>Wed, 13 Sep 2017 13:38:17 GMT</pubDate>
    <dc:creator>andrewhlui</dc:creator>
    <dc:date>2017-09-13T13:38:17Z</dc:date>
    <item>
      <title>How to rearrange table by values in a column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333725#M99232</link>
      <description>&lt;P&gt;So I have the following data as output statistics from a search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;User      Group         Number
Andy          A            123
Andy          B            123
Andy          C            123
Bob           A            123
Bob           B            123
Cam           A            123
Cam           B            123
Cam           C            123
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I rearrange it so that it becomes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;User         A         B        C
Andy       123       123      123
Bob        123       123        0
Cam        123       123      123
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, what is this rearranging called?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 13:38:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333725#M99232</guid>
      <dc:creator>andrewhlui</dc:creator>
      <dc:date>2017-09-13T13:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to rearrange table by values in a column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333726#M99233</link>
      <description>&lt;P&gt;Never mind, I figured out an answer:&lt;/P&gt;

&lt;P&gt;... |  xyseries User, Group, Number&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 13:48:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333726#M99233</guid>
      <dc:creator>andrewhlui</dc:creator>
      <dc:date>2017-09-13T13:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to rearrange table by values in a column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333727#M99234</link>
      <description>&lt;P&gt;Hi andrewhlui,&lt;BR /&gt;
add to your search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| chart sum(Number) AS Number over User BY Group
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you like you can use different functions instead sum.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 13:48:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333727#M99234</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-09-13T13:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to rearrange table by values in a column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333728#M99235</link>
      <description>&lt;P&gt;You are looking for the &lt;CODE&gt;chart&lt;/CODE&gt; command...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval User="Andy Bob Cam", Group="A B C" 
| makemv User 
| mvexpand User 
| makemv Group 
| mvexpand Group 
| Where NOT (Group="C" AND User="Bob") 
| eval Number = 123
| rename COMMENT as "the above just enters your test data"

| chart sum(Number) over User by Group
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...and then after you review the above, add this on the end and look at this handy little reverse tool...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| untable User Group Number
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Sep 2017 13:54:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333728#M99235</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-13T13:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to rearrange table by values in a column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333729#M99236</link>
      <description>&lt;P&gt;@andrewhliu - yep, &lt;CODE&gt;xyseries&lt;/CODE&gt; will work too.  Check out the &lt;CODE&gt;untable&lt;/CODE&gt; command on the results.  &lt;/P&gt;

&lt;P&gt;We're converting your comment to an answer.  Please accept the answer so that the question will show as answered.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 13:58:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333729#M99236</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-13T13:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to rearrange table by values in a column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333730#M99237</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;There is a command called  &lt;CODE&gt;transpose&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transpose"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transpose&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;Try it out with DalJeanis example: &lt;/P&gt;

&lt;P&gt;| makeresults &lt;BR /&gt;
| eval User="Andy Bob Cam", Group="A B C" &lt;BR /&gt;
| makemv User &lt;BR /&gt;
| mvexpand User &lt;BR /&gt;
| makemv Group &lt;BR /&gt;
| mvexpand Group &lt;BR /&gt;
| Where NOT (Group="C" AND User="Bob") &lt;BR /&gt;
| eval Number = 123&lt;BR /&gt;
| rename COMMENT as "the above just enters your test data"&lt;BR /&gt;
| chart sum(Number) over User by Group&lt;BR /&gt;
| transpose&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 14:16:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rearrange-table-by-values-in-a-column/m-p/333730#M99237</guid>
      <dc:creator>abalogh_splunk</dc:creator>
      <dc:date>2017-09-13T14:16:46Z</dc:date>
    </item>
  </channel>
</rss>

