<?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 do you swap key/value pairs for two-column data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-swap-key-value-pairs-for-two-column-data/m-p/218298#M64155</link>
    <description>&lt;P&gt;I'm trying to swap the roles of two columns.  Normally, there is one "key" in the first column for every group of "values" in the second column.  What if I want the values to become the keys?  For instance, let's say the search "|index = dataname| table ColA, ColB" returns the following: &lt;/P&gt;

&lt;P&gt;Col A        Col B&lt;BR /&gt;
John         Seahawks, Lions, 49ers&lt;BR /&gt;
Jason       Titans, Seahawks, Dolphins&lt;BR /&gt;
Rick          Texans, Dolphins&lt;/P&gt;

&lt;P&gt;I'd like the search redone.  Should become&lt;/P&gt;

&lt;P&gt;Col B        Col A&lt;BR /&gt;
Seahawks  John, Jason&lt;BR /&gt;
Lions          John&lt;BR /&gt;
49ers          John&lt;BR /&gt;
Titans         Jason&lt;BR /&gt;
Dolphins    Jason, Rick&lt;BR /&gt;
Texans       Rick&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jan 2017 06:23:37 GMT</pubDate>
    <dc:creator>jturner900</dc:creator>
    <dc:date>2017-01-04T06:23:37Z</dc:date>
    <item>
      <title>How do you swap key/value pairs for two-column data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-swap-key-value-pairs-for-two-column-data/m-p/218298#M64155</link>
      <description>&lt;P&gt;I'm trying to swap the roles of two columns.  Normally, there is one "key" in the first column for every group of "values" in the second column.  What if I want the values to become the keys?  For instance, let's say the search "|index = dataname| table ColA, ColB" returns the following: &lt;/P&gt;

&lt;P&gt;Col A        Col B&lt;BR /&gt;
John         Seahawks, Lions, 49ers&lt;BR /&gt;
Jason       Titans, Seahawks, Dolphins&lt;BR /&gt;
Rick          Texans, Dolphins&lt;/P&gt;

&lt;P&gt;I'd like the search redone.  Should become&lt;/P&gt;

&lt;P&gt;Col B        Col A&lt;BR /&gt;
Seahawks  John, Jason&lt;BR /&gt;
Lions          John&lt;BR /&gt;
49ers          John&lt;BR /&gt;
Titans         Jason&lt;BR /&gt;
Dolphins    Jason, Rick&lt;BR /&gt;
Texans       Rick&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 06:23:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-swap-key-value-pairs-for-two-column-data/m-p/218298#M64155</guid>
      <dc:creator>jturner900</dc:creator>
      <dc:date>2017-01-04T06:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do you swap key/value pairs for two-column data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-swap-key-value-pairs-for-two-column-data/m-p/218299#M64156</link>
      <description>&lt;P&gt;Splunk statistics commands like stats timechart can split data by the sequence of the field names. So in order to reverse the columns you can try the following two commands&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = dataname
| stats count by ColA ColB

index = dataname
| stats count by ColB ColA 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jan 2017 07:08:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-swap-key-value-pairs-for-two-column-data/m-p/218299#M64156</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-01-04T07:08:58Z</dc:date>
    </item>
  </channel>
</rss>

