<?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: Excel Like Pivot Table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Excel-Like-Pivot-Table/m-p/365871#M107901</link>
    <description>&lt;P&gt;I don't think what you are looking for is possible in Splunk in that way. You either have individual lines for each entry, with customer repeated on each line, or you have aggregated results, where there is 1 line per customer.&lt;/P&gt;

&lt;P&gt;Of course you can cheat, by simply emptying the customer field for each non-first row per customer, by adding the following below your search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | streamstats count by customer
 | eval customer=if(count=1,customer,"")
 | fields - count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But that does mean you loose the customer field value for those rows, so if you want to do this because you like the way that looks in a report: do it all the way at the end of your search. And it will mean that if someone who opens the report starts sorting the customer column differently, things will also get messed up.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Apr 2018 08:36:46 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2018-04-27T08:36:46Z</dc:date>
    <item>
      <title>Excel Like Pivot Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excel-Like-Pivot-Table/m-p/365870#M107900</link>
      <description>&lt;P&gt;I'm trying to figure out how to build an excel-like pivot table using 3 or more columns.  As example, I have this data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;customer1   project1    note1
customer1   project2    
customer1   project3    note2
customer2   project4    note3
customer2   project5    
customer2   project6    note4
customer2   project7    note5
customer3   project8    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I want to build a report that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;customer1   project1    note1
             project2   
             project3   note2
customer2   project4    note3
             project5   
             project6   note4
             project7   note5
customer3   project8    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've been playing with stats list() and values() and both lose the relationship between the second and third columns. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 1 
| eval pickle="customer1,project1,note1|customer1,project2,|customer1,project3,note2|customer2,project4,note3|customer2,project5,|customer2,project6,note4|customer2,project7,note5|customer3,project8"
| eval pickle=split(pickle,"|")
| mvexpand pickle
| eval pickle=split(pickle,",")
| eval customer=mvindex(pickle,0)
| eval project=mvindex(pickle,1)
| eval note=mvindex(pickle,2)
| fields - _time pickle
| stats list(project) as project list(note) as note by customer
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4845i7C0C4989039DEF8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Notice the highlighted notes fall under the wrong project. I get the same behavior with stats values().&lt;/P&gt;

&lt;P&gt;Is there a way to go about getting a multi column relational list without repeating the customer name in the output?&lt;/P&gt;

&lt;P&gt;Any ideas anyone has are greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 23:03:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excel-Like-Pivot-Table/m-p/365870#M107900</guid>
      <dc:creator>jperry_intact</dc:creator>
      <dc:date>2018-04-26T23:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Like Pivot Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excel-Like-Pivot-Table/m-p/365871#M107901</link>
      <description>&lt;P&gt;I don't think what you are looking for is possible in Splunk in that way. You either have individual lines for each entry, with customer repeated on each line, or you have aggregated results, where there is 1 line per customer.&lt;/P&gt;

&lt;P&gt;Of course you can cheat, by simply emptying the customer field for each non-first row per customer, by adding the following below your search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | streamstats count by customer
 | eval customer=if(count=1,customer,"")
 | fields - count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But that does mean you loose the customer field value for those rows, so if you want to do this because you like the way that looks in a report: do it all the way at the end of your search. And it will mean that if someone who opens the report starts sorting the customer column differently, things will also get messed up.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 08:36:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excel-Like-Pivot-Table/m-p/365871#M107901</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-04-27T08:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Like Pivot Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Excel-Like-Pivot-Table/m-p/365872#M107902</link>
      <description>&lt;P&gt;I was afraid of that. Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 14:53:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Excel-Like-Pivot-Table/m-p/365872#M107902</guid>
      <dc:creator>jperry_intact</dc:creator>
      <dc:date>2018-04-30T14:53:28Z</dc:date>
    </item>
  </channel>
</rss>

