<?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: Can someone help with the search to format this table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377976#M110838</link>
    <description>&lt;P&gt;So, in the final output there will only single row? What value should each "week ending date" should show?&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jul 2018 20:44:01 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2018-07-27T20:44:01Z</dc:date>
    <item>
      <title>Can someone help with the search to format this table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377973#M110835</link>
      <description>&lt;P&gt;Hello I have  challenged with a difficult formatting task. I have a very long search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=testindex "Type" = "services" "ID" = *
| dedup "Name", "Workflow Phase", "Workflow Process Name", "Workflow Step Name"
| convert timeformat="%Y-%m-%d %H:%M:%S.%6N"  mktime("Step Date Started") AS starttime  mktime("Step Date Completed") AS endtime mktime("Step Due Date") AS stepDueDate
| eval dueDateRange=mvrange(stepDueDate,now(),86400)
| convert ctime(dueDateRange) timeformat="%+" | eval daysPastDue=mvcount(dueDateRange)
| fillnull value="" "Step Date Started" "Step Date Completed"
| eval stepStatus=case('Step Date Started' == "" AND 'Step Date Completed' == "", "Not Started", 'Step Date Started' != "" AND 'Step Date Completed' == "", "Started", 'Step Date Started' != "" AND 'Step Date Completed' != "", "Completed" )
| eval DaysPastDue=if(stepStatus == "Completed", "0", daysPastDue)
| eval isWin = if(DaysPastDue &amp;gt; 'SLA', "Miss","Win")
| eval MissedSLA=if(isWin == "Miss", "Miss", "")
| eval previousMonthepoch=relative_time(now(), "-1mon@mon")
| eval previousMonth=strftime(previousMonthepoch,"%b")
| eval nowMonth=strftime(now(),"%b")
| eval eventCompMonth=strftime(strptime('Step Date Completed',"%Y-%m-%d %H:%M:%S.%6N"),"%b")
| eval compMonth=case( nowMonth == eventCompMonth, "Current Month", previousMonth == eventCompMonth, "Previous Month", previousMonth != eventCompMonth, "Previous")
| eval datecompleted_epoch = strptime('Step Date Started', "%Y-%m-%d %H:%M:%S.%6N")
| eval slaSeconds='SLA' * 86400
| eval newDate= datecompleted_epoch + slaSeconds
| eval updatedProjCompDate=strftime('newDate', "%Y-%m-%d %H:%M:%S.%6N")
| eval "Projected Completion Date"=case(stepStatus == "Not Started", 'Step Due Date', stepStatus == "Started", updatedProjCompDate, stepStatus == "Completed", 'Step Date Completed')


|join "ID" [`init(services)`
|rename id as "ID" info_name as RiskRank
| rex mode=sed field="related_vendors" "s/[][]//g"
| rex mode=sed field="related_vendors" "s/'//g"
| makemv delim="," related_vendors
| eval RV = mvindex(related_vendors,0)
|fields RV RiskRank "ID"]


| join RV [`init(assessments)`  |rename id as RV |rename info_name as AssessmentName 
| rex mode=sed field="related_vendors" "s/[][]//g"
| rex mode=sed field="related_vendors" "s/'//g"
| makemv delim="," related_vendors
| eval RV = mvindex(related_vendors,0)
|fields RV AssessmentName]

|fillnull value=NA
| table AssessmentName RiskRank "Workflow Phase" "Workflow Process Name" "Workflow Step Name" stepStatus compMonth SLA "Projected Completion Date"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For reasons I have to join due to same fieldnames using different values based on the value in the init macro. &lt;BR /&gt;
This results in a table such as :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;AssessmentName  RiskRank    Workflow Phase  Workflow Process Name   Workflow Step Name  stepStatus  compMonth   SLA Projected Completion Date
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Risk Rank Approved  Not Started NA  3   2018-08-29 16:02:46
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Add Vendor Locations    Not Started NA  5   2018-08-24 16:02:46
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Link Locations  Not Started NA  5   2018-08-17 16:02:46
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Link Full Legal Name    Not Started NA  5   2018-08-10 16:02:46
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Select Engagement Scope Not Started NA  5   2018-08-03 16:02:46
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Link Contract   Not Started NA  2   2018-07-27 16:02:46
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Risk Rank Reviewed  Started NA  3   2018-07-21 19:02:54
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Risk Rank Submitted by Business Completed   Current Month   2   2018-07-18 19:02:49
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm trying to re-create the attached table.&lt;A href="https://answers.splunk.comstorage/temp/253600-tablechallenge.pdf"&gt;link text&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I have the necessary data calculated by adding this at the end but it doesnt give the format I'm trying to create:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats count("Workflow Step Name") as CompltetedMonth by AssessmentName RiskRank "Workflow Phase" "Workflow Process Name"  compMonth
    | eventstats count(eval((stepStatus != "Completed"))) as Pending, count(eval((stepStatus = "Completed"))) as CompletedTotals
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which returns a table like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;AssessmentName  RiskRank    Workflow Phase  Workflow Process Name   Workflow Step Name  stepStatus  compMonth   SLA Projected Completion Date   CompletedTotals CompltetedMonth Pending
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Risk Rank Approved  Not Started NA  3   2018-08-29 16:02:46 23  15  31
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Add Vendor Locations    Not Started NA  5   2018-08-24 16:02:46 23  15  31
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Link Locations  Not Started NA  5   2018-08-17 16:02:46 23  15  31
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Link Full Legal Name    Not Started NA  5   2018-08-10 16:02:46 23  15  31
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Select Engagement Scope Not Started NA  5   2018-08-03 16:02:46 23  15  31
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Link Contract   Not Started NA  2   2018-07-27 16:02:46 23  15  31
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Risk Rank Reviewed  Started NA  3   2018-07-21 19:02:54 23  15  31
Test Co. SIG Full   Contract for construction services cntrct#5 Plan    Risk Rank   Risk Rank Submitted by Business Completed   Current Month   2   2018-07-18 19:02:49 23  1   31
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any ideas how I could alter my table/eventstats to more closely duplicate the attached table/chart?&lt;BR /&gt;
Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 15:42:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377973#M110835</guid>
      <dc:creator>tkwaller_2</dc:creator>
      <dc:date>2018-07-27T15:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help with the search to format this table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377974#M110836</link>
      <description>&lt;P&gt;What is "prior" column in your pdf relates to in your current output? Also, is CompletedTotals (in last table)  same as CompletedNumbers (in last query)?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:10:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377974#M110836</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-07-27T19:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help with the search to format this table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377975#M110837</link>
      <description>&lt;P&gt;OK I updated the question for the CompletedTotals/CompletedNumbers issue.&lt;/P&gt;

&lt;P&gt;The Prior column in the pdf means prior months. What they are looking for is when was the step completed, this month, last month or prior? So what Im doing is taking the field Step Date Completed, IF it exists and calculating the month it was completed using:&lt;BR /&gt;
    | eval previousMonthepoch=relative_time(now(), "-1mon@mon")&lt;BR /&gt;
    | eval previousMonth=strftime(previousMonthepoch,"%b")&lt;BR /&gt;
    | eval nowMonth=strftime(now(),"%b")&lt;BR /&gt;
    | eval eventCompMonth=strftime(strptime('Step Date Completed',"%Y-%m-%d %H:%M:%S.%6N"),"%b")&lt;BR /&gt;
    | eval compMonth=case( nowMonth == eventCompMonth, "Current Month", previousMonth == eventCompMonth, "Previous Month", previousMonth != eventCompMonth, "Previous")&lt;/P&gt;

&lt;P&gt;If it doesnt exist I fill with NA&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 20:29:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377975#M110837</guid>
      <dc:creator>tkwaller_2</dc:creator>
      <dc:date>2018-07-27T20:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help with the search to format this table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377976#M110838</link>
      <description>&lt;P&gt;So, in the final output there will only single row? What value should each "week ending date" should show?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 20:44:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377976#M110838</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-07-27T20:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help with the search to format this table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377977#M110839</link>
      <description>&lt;P&gt;So what I'm expecting, maybe incorrectly lol, is a single row,the table would be like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;AssessmentName RiskRank "Workflow Phase" "Workflow Process Name" "Workflow Step Name"   "Prior" "Previous Month"      "Current Month"    "7/6"  "7/13"  "7/20"  "7/27"  "8/3"   "8/10"  "8/17"  "8/24"  "8/31"  "TOTAL PENDING" "TOTAL COMPLETE"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With a row like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Test Co. SIG Full     Contract for construction services cntrct#5    Plan    Risk Rank    Risk Rank Submitted by Business    Completed  &amp;lt;count(compMonth) by vaues(compMonth)&amp;gt; &amp;lt;count(CompletionDate) by values(CompletionDate)&amp;gt;  1    31
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To answer your question:&lt;BR /&gt;
What value should each "week ending date" should show?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;count(CompletionDate) by values(CompletionDate)&amp;gt; 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;would be fine&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 14:16:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377977#M110839</guid>
      <dc:creator>tkwaller_2</dc:creator>
      <dc:date>2018-07-30T14:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help with the search to format this table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377978#M110840</link>
      <description>&lt;P&gt;In was hoping this woudl work but it did not:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats  count(compMonth) as compMonth count("Projected Completion Date") as "Projected Completion Date" by values(compMonth)  values("Projected Completion Date")  AssessmentName RiskRank "Workflow Phase" "Workflow Process Name" "Workflow Step Name" stepStatus
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Jul 2018 14:55:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-the-search-to-format-this-table/m-p/377978#M110840</guid>
      <dc:creator>tkwaller_2</dc:creator>
      <dc:date>2018-07-30T14:55:54Z</dc:date>
    </item>
  </channel>
</rss>

