<?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 make the date as header in table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360045#M106446</link>
    <description>&lt;P&gt;You might want to sanitize your screenshot, looks like that contains some data that may not be suitable for sharing publicly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Feb 2018 15:38:23 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2018-02-07T15:38:23Z</dc:date>
    <item>
      <title>How to make the date as header in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360043#M106444</link>
      <description>&lt;P&gt;I need to do a table which look like this (see below).&lt;BR /&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/4320i08992C73A13661F7/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;As of now my table look like this&lt;BR /&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/4321i81ED2651157731B5/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;How can I make the months or dates in header?&lt;BR /&gt;
Here's my query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="sharepoint_capacity" 
| dedup ID 
| eval epoch_end=strptime('Capacity End Date',"%m/%d/%Y")+86400, epoch_start=strptime('Capacity Start Date',"%m/%d/%Y"), between=mvrange(epoch_start,epoch_end,"1d") 
| mvexpand between 
| eval middle=strftime(between,"%Y %B"), months=strftime(between,"%B") , _time=middle 
| stats count by "Resource Name", FTE ,"Project Name" middle months 
| rename FTE as Allocation
| eval time_range=case(months="September" OR months="April" OR months="June" OR months="November",30,months="February",28,1=1,31),range=round((count/time_range)*100,2)
| fields - months count time_range
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Feb 2018 14:35:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360043#M106444</guid>
      <dc:creator>katrinamara</dc:creator>
      <dc:date>2018-02-07T14:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the date as header in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360044#M106445</link>
      <description>&lt;P&gt;try adding this to the end of your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval {middle}=range|fields - middle range
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you could use &lt;STRONG&gt;months&lt;/STRONG&gt; in the eval, you just have to do it before the &lt;CODE&gt;|fields - months...&lt;/CODE&gt;, if that's the field you want as the header, instead of &lt;STRONG&gt;middle&lt;/STRONG&gt;. &lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 15:29:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360044#M106445</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-02-07T15:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the date as header in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360045#M106446</link>
      <description>&lt;P&gt;You might want to sanitize your screenshot, looks like that contains some data that may not be suitable for sharing publicly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 15:38:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360045#M106446</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-02-07T15:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the date as header in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360046#M106447</link>
      <description>&lt;P&gt;Thanks for replying, just tried the query you gave. Now middle is part of my header. &lt;BR /&gt;
I just need to combine the range value if the Resource Name and Project Name. &lt;/P&gt;

&lt;P&gt;As of now my table looks like this.&lt;BR /&gt;
Resource Name        Allocation       Project Name       Jan         Feb&lt;BR /&gt;
Employee A                  1.0                   Proj 1                   50&lt;BR /&gt;
Employee A                  1.0                   Proj 1                                 100&lt;/P&gt;

&lt;P&gt;Expected output:&lt;BR /&gt;
Resource Name        Allocation       Project Name       Jan         Feb&lt;BR /&gt;
Employee A                  1.0                   Proj 1                   50          100&lt;/P&gt;

&lt;P&gt;Do you have any idea how can I do this?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 15:49:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360046#M106447</guid>
      <dc:creator>katrinamara</dc:creator>
      <dc:date>2018-02-07T15:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the date as header in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360047#M106448</link>
      <description>&lt;P&gt;try adding &lt;CODE&gt;|stats values(*) as * by "Resource Name" Allocation "Project Name"&lt;/CODE&gt; to the end.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 16:20:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360047#M106448</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-02-07T16:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the date as header in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360048#M106449</link>
      <description>&lt;P&gt;It works thanks! &lt;BR /&gt;
I just need to sort the date in header. can you also help me to sort it? &lt;BR /&gt;
Format should be: Nov 2017, Dec 2017, Jan 2018, etc.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 16:33:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360048#M106449</guid>
      <dc:creator>katrinamara</dc:creator>
      <dc:date>2018-02-07T16:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the date as header in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360049#M106450</link>
      <description>&lt;P&gt;sorting dates like that is very tricky because splunk sorts alphanumerically. Generally, I try to keep my dates in the format of yyyy-mm-dd so that it sorts year first, then numeric month, followed by numeric day. I'm not sure if it is possible for you to do that based on reqs or not. if you changed the format of &lt;STRONG&gt;middle&lt;/STRONG&gt; before putting it as a header, then sorted, it should work. otherwise, you'll have to use &lt;CODE&gt;|table "Resource Name" Allocation "Project Name" "Nov 2017" "Dec 2017" "Jan 2018"...&lt;/CODE&gt; and write it all out, which isn't great for dynamic fields. &lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 16:40:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360049#M106450</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-02-07T16:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the date as header in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360050#M106451</link>
      <description>&lt;P&gt;I agree it is very tricky when it comes in sorting the date. My data should show per month that's why the format yyyy-mm-dd will no be possible. Anyway thanks! &lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 16:43:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360050#M106451</guid>
      <dc:creator>katrinamara</dc:creator>
      <dc:date>2018-02-07T16:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the date as header in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360051#M106452</link>
      <description>&lt;P&gt;you can exclude the &lt;CODE&gt;dd&lt;/CODE&gt; on the date format and just do &lt;CODE&gt;yyyy-mm&lt;/CODE&gt;, i was just using an example if ever needing to go down to day level. in your line 5, try this instead:  &lt;CODE&gt;| eval middle=strftime(between,"%Y-%m")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 16:46:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-the-date-as-header-in-table/m-p/360051#M106452</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-02-07T16:46:05Z</dc:date>
    </item>
  </channel>
</rss>

