<?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 to write a search to organize data from a CSV file into a table format? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-organize-data-from-a-CSV-file-into-a/m-p/250101#M74670</link>
    <description>&lt;P&gt;Show CSV file (just the 4 fields: &lt;CODE&gt;Client_Name&lt;/CODE&gt;, &lt;CODE&gt;Resource&lt;/CODE&gt;, &lt;CODE&gt;Tper&lt;/CODE&gt;, &lt;CODE&gt;Hours&lt;/CODE&gt;) data as comment under this and I will help you.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Nov 2015 22:10:01 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-11-24T22:10:01Z</dc:date>
    <item>
      <title>How to write a search to organize data from a CSV file into a table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-organize-data-from-a-CSV-file-into-a/m-p/250100#M74669</link>
      <description>&lt;P&gt;I am trying to arrange some information received in a CSV file in a table format (as per example)&lt;/P&gt;

&lt;P&gt;The two searches I used was as follow:&lt;BR /&gt;
&lt;STRONG&gt;Search 1&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="labour" | stats sum(Hours) as TotalHours BY Client_Name, Resource | streamstats sum(Hours) BY Client_Name, Resource | stats list(Resource) as Resource_Name, list(TotalHours) as "Per Resource", sum(TotalHours) as TotalHours by Client_Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Client_Name Resource_Name    Per Resource     TotalHours
Client 3        Resource 1          8              12
             Resource 5             4   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Search 2&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="labour" | stats first(Tper) as Week by Hours, Client_Name, Resource  | xyseries Client_Name Week Hours | addtotals
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Client_Name Week25    Week26    Total
Client 3         6       6       12
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope someone can make sense of this to assist me please.&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&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/846i1882B304C2E3311A/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 21:13:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-organize-data-from-a-CSV-file-into-a/m-p/250100#M74669</guid>
      <dc:creator>denisevw</dc:creator>
      <dc:date>2015-11-24T21:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search to organize data from a CSV file into a table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-organize-data-from-a-CSV-file-into-a/m-p/250101#M74670</link>
      <description>&lt;P&gt;Show CSV file (just the 4 fields: &lt;CODE&gt;Client_Name&lt;/CODE&gt;, &lt;CODE&gt;Resource&lt;/CODE&gt;, &lt;CODE&gt;Tper&lt;/CODE&gt;, &lt;CODE&gt;Hours&lt;/CODE&gt;) data as comment under this and I will help you.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 22:10:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-organize-data-from-a-CSV-file-into-a/m-p/250101#M74670</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-24T22:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search to organize data from a CSV file into a table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-organize-data-from-a-CSV-file-into-a/m-p/250102#M74671</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;/P&gt;

&lt;P&gt;You can use this example csv:&lt;/P&gt;

&lt;P&gt;Client_Name,Resource_Name,Text,Activity,Activity_Description,Time_Code,Time_Code_Description,Tper,Date,Month,Month_Description,Unit_Description,Hours,Percentage&lt;BR /&gt;
Client 1,Resource 1,Documentation,CON,Consulting,0,Regular Hours,201525,2015-08-31,201508,15-Aug,Hours,1,0.6&lt;BR /&gt;
Client 1,Resource 2,Documentation,SUP,Client Support,0,Regular Hours,201526,2015-08-11,201508,15-Aug,Hours,5,3&lt;BR /&gt;
Client 1,Resource 3,Documentation,CON,Consulting,0,Regular Hours,201525,2015-08-04,201508,15-Aug,Hours,2,1.2&lt;BR /&gt;
Client 1,Resource 4,Documentation,TRA,Travel,0,Regular Hours,201526,2015-08-04,201508,15-Aug,Hours,2,1.2&lt;BR /&gt;
Client 1,Resource 5,Documentation,CON,Consulting,0,Regular Hours,201525,2015-08-12,201508,15-Aug,Hours,2,1.2&lt;BR /&gt;
Client 2,Resource 1,Documentation,CON,Consulting,0,Regular Hours,201526,2015-08-19,201508,15-Aug,Hours,6,3.6&lt;BR /&gt;
Client 2,Resource 3,Documentation,TRA,Travel,0,Regular Hours,201525,2015-08-19,201508,15-Aug,Hours,1,0.6&lt;BR /&gt;
Client 2,Resource 5,Documentation,PRM,Project Management,0,Regular Hours,201526,2015-08-26,201508,15-Aug,Hours,2,1.2&lt;BR /&gt;
Client 3,Resource 1,Documentation,TRA,Travel,0,Regular Hours,201525,2015-08-13,201508,15-Aug,Hours,1,0.6&lt;BR /&gt;
Client 3,Resource 5,Documentation,CON,Consulting,0,Regular Hours,201526,2015-08-13,201508,15-Aug,Hours,5,3&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:58:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-organize-data-from-a-CSV-file-into-a/m-p/250102#M74671</guid>
      <dc:creator>denisevw</dc:creator>
      <dc:date>2020-09-29T07:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search to organize data from a CSV file into a table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-organize-data-from-a-CSV-file-into-a/m-p/250103#M74672</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats sum(Hours) as TotalHours BY Client_Name, Resource, Tper
| eval host=Client_Name . "::" . Resource | fields - Client_Name Resource
| xyseries host Tper TotalHours
| rex field=host "^(?&amp;lt;Client_Name&amp;gt;.*)::(?&amp;lt;Resource&amp;gt;.*)$" | fields - host
| eval BothHours=0 | foreach 2* [ eval BothHours = BothHours + $&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;$ ]
| stats sum(BothHours) AS TotalHours list(2015*) AS week* sum(2015*) AS sum* list(Resource) AS Resource BY Client_Name
| addtotals row=f col=t
| fillnull value="CLIENT_TOTALS"
| foreach week* [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = if((Client_Name = "CLIENT_TOTALS"), $sum&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;$, $&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;$) ]
| fields - sum*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Nov 2015 13:55:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-to-organize-data-from-a-CSV-file-into-a/m-p/250103#M74672</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-25T13:55:06Z</dc:date>
    </item>
  </channel>
</rss>

