<?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 work out Total Staff numbers Entering Buildiing Each Day and Weekly Total in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363760#M165103</link>
    <description>&lt;P&gt;&lt;STRONG&gt;[UPDATE]&lt;BR /&gt;
Added time formatted as weekday number and weekday name abbreviation&lt;/STRONG&gt;. &lt;BR /&gt;
Try the following search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
|  bin _time span=1d
|  stats count as TotalLogins by _time FirstName LastName Building
|  eval FullName=FirstName." ".LastName, Time=strftime(_time,"%w  %a")
|  chart dc(FullName) as LoginCount by Time Building
|  addcoltotals labelfield="Time" label="Total"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to reverse the table rows and columns&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
|  bin _time span=1d
|  stats count as TotalLogins by _time FirstName LastName Building
|  eval FullName=FirstName." ".LastName
|  eval Time=strftime(_time,"%w  %a")
|  chart dc(FullName) as LoginCount by Building Time
|  addcoltotals labelfield="Building" label="Total"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Following will give the coefficient table i.e. Total of Rows and Total of columns in matrix like format.&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;YourBaseSearch&amp;gt;
 |  bin _time span=1d
 |  stats count as TotalLogins by _time FirstName LastName Building
 |  eval FullName=FirstName." ".LastName, Time=strftime(_time,"%w  %a")
 | ctable Time Building
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or if you want inverse try &lt;CODE&gt;| ctable Building Time&lt;/CODE&gt; as your final pipe (&lt;STRONG&gt;Try this first as this will be closest to what you need&lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;YourBaseSearch&amp;gt;
 |  bin _time span=1d
 |  stats count as TotalLogins by _time FirstName LastName Building
 |  eval FullName=FirstName." ".LastName, Time=strftime(_time,"%w  %a")
 | ctable Building Time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Assuming you have three fields in your events &lt;CODE&gt;FirstName&lt;/CODE&gt;, &lt;CODE&gt;LastName&lt;/CODE&gt; and &lt;CODE&gt;Building&lt;/CODE&gt;(if not replace the same accordingly in the query below), try the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
|  stats count as TotalLogins by FirstName LastName Building
|  eval FullName=FirstName." ".LastName
|  chart dc(FullName) as LoginCount sum(TotalLogins) as TotalLogins by  FullName Building
|  fillnull value=0
|  addcoltotals labelfield="FullName"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Breakdown of the query:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;First stats command will be similar in effect to &lt;CODE&gt;dedup&lt;/CODE&gt; however it will keep a count of every time a person enters a building as &lt;CODE&gt;TotalLogins&lt;/CODE&gt;.&lt;/LI&gt;
&lt;LI&gt;Since your event does no have single field containing &lt;CODE&gt;FullName&lt;/CODE&gt;, you should perform eval (after stats command) to combine FirstName and LastName.&lt;/LI&gt;
&lt;LI&gt;Add another chart command, &lt;CODE&gt;dc(FullName) as LoginCount&lt;/CODE&gt; will give how many people entered the building. The &lt;CODE&gt;sum(TotalLogins) as TotalLogins&lt;/CODE&gt; give every time a person entered the building. (As per your question this is not required, but this will account for scenario when a person went out and came back in. &lt;/LI&gt;
&lt;LI&gt;If you are not using sum(TotalLogins) you will not require fillnull as it puts value as 0 where the same is null.&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;addcoltotals&lt;/CODE&gt; command in the final pipe sums all numeric fields and displays the &lt;CODE&gt;Total&lt;/CODE&gt; value under &lt;CODE&gt;FullName&lt;/CODE&gt; field. &lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Thu, 16 Nov 2017 13:36:04 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-11-16T13:36:04Z</dc:date>
    <item>
      <title>How to work out Total Staff numbers Entering Buildiing Each Day and Weekly Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363757#M165100</link>
      <description>&lt;P&gt;Afternoon Splunk Community&lt;/P&gt;

&lt;P&gt;Can you help me solve a problem?&lt;/P&gt;

&lt;P&gt;I have been asked to supply a report showing numbers of staff entering our 2 office buildings (Building A, Building B) &lt;BR /&gt;
Mon-Fri broken down with totals for each day and overall totals per building.&lt;/P&gt;

&lt;P&gt;I am looking at using the addtotals command but finding it tricky as I don't have numeric fields just names and door names&lt;BR /&gt;
I have had to | dedup FirstName | dedup Surname for building A and now have a credible number over a 24hr period.&lt;/P&gt;

&lt;P&gt;How do I convert this to a table, with totals at bottom for each day and total at end for whole week ?&lt;/P&gt;

&lt;P&gt;Many thanks for anyone who can solve my riddle.&lt;/P&gt;

&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 12:34:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363757#M165100</guid>
      <dc:creator>DDewarSplunk</dc:creator>
      <dc:date>2017-11-16T12:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to work out Total Staff numbers Entering Buildiing Each Day and Weekly Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363758#M165101</link>
      <description>&lt;P&gt;first, i would &lt;CODE&gt;|dedup FIrstName Surname&lt;/CODE&gt; in the same command, not separately, since you could have multiple people with either the same first or last name. You may even run into people having the same full name, but that's a discrepancy you'll have to acknowledge. &lt;/P&gt;

&lt;P&gt;do you have _time available? or what type of reference do you have in your data to the day?&lt;/P&gt;

&lt;P&gt;after the &lt;CODE&gt;dedup&lt;/CODE&gt;, try something like &lt;CODE&gt;|stats count by day&lt;/CODE&gt; or &lt;CODE&gt;|timechart span=1d count&lt;/CODE&gt; and you can maybe add &lt;CODE&gt;|addtotals&lt;/CODE&gt; or &lt;CODE&gt;|eventstats sum(count) as total&lt;/CODE&gt; for summaries&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 13:09:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363758#M165101</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-11-16T13:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to work out Total Staff numbers Entering Buildiing Each Day and Weekly Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363759#M165102</link>
      <description>&lt;P&gt;DDewarSplunk, please provide more information about your actual search and how the data is being showed today with you actual search&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 13:09:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363759#M165102</guid>
      <dc:creator>thiagodede</dc:creator>
      <dc:date>2017-11-16T13:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to work out Total Staff numbers Entering Buildiing Each Day and Weekly Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363760#M165103</link>
      <description>&lt;P&gt;&lt;STRONG&gt;[UPDATE]&lt;BR /&gt;
Added time formatted as weekday number and weekday name abbreviation&lt;/STRONG&gt;. &lt;BR /&gt;
Try the following search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
|  bin _time span=1d
|  stats count as TotalLogins by _time FirstName LastName Building
|  eval FullName=FirstName." ".LastName, Time=strftime(_time,"%w  %a")
|  chart dc(FullName) as LoginCount by Time Building
|  addcoltotals labelfield="Time" label="Total"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to reverse the table rows and columns&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
|  bin _time span=1d
|  stats count as TotalLogins by _time FirstName LastName Building
|  eval FullName=FirstName." ".LastName
|  eval Time=strftime(_time,"%w  %a")
|  chart dc(FullName) as LoginCount by Building Time
|  addcoltotals labelfield="Building" label="Total"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Following will give the coefficient table i.e. Total of Rows and Total of columns in matrix like format.&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;YourBaseSearch&amp;gt;
 |  bin _time span=1d
 |  stats count as TotalLogins by _time FirstName LastName Building
 |  eval FullName=FirstName." ".LastName, Time=strftime(_time,"%w  %a")
 | ctable Time Building
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or if you want inverse try &lt;CODE&gt;| ctable Building Time&lt;/CODE&gt; as your final pipe (&lt;STRONG&gt;Try this first as this will be closest to what you need&lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;YourBaseSearch&amp;gt;
 |  bin _time span=1d
 |  stats count as TotalLogins by _time FirstName LastName Building
 |  eval FullName=FirstName." ".LastName, Time=strftime(_time,"%w  %a")
 | ctable Building Time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Assuming you have three fields in your events &lt;CODE&gt;FirstName&lt;/CODE&gt;, &lt;CODE&gt;LastName&lt;/CODE&gt; and &lt;CODE&gt;Building&lt;/CODE&gt;(if not replace the same accordingly in the query below), try the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
|  stats count as TotalLogins by FirstName LastName Building
|  eval FullName=FirstName." ".LastName
|  chart dc(FullName) as LoginCount sum(TotalLogins) as TotalLogins by  FullName Building
|  fillnull value=0
|  addcoltotals labelfield="FullName"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Breakdown of the query:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;First stats command will be similar in effect to &lt;CODE&gt;dedup&lt;/CODE&gt; however it will keep a count of every time a person enters a building as &lt;CODE&gt;TotalLogins&lt;/CODE&gt;.&lt;/LI&gt;
&lt;LI&gt;Since your event does no have single field containing &lt;CODE&gt;FullName&lt;/CODE&gt;, you should perform eval (after stats command) to combine FirstName and LastName.&lt;/LI&gt;
&lt;LI&gt;Add another chart command, &lt;CODE&gt;dc(FullName) as LoginCount&lt;/CODE&gt; will give how many people entered the building. The &lt;CODE&gt;sum(TotalLogins) as TotalLogins&lt;/CODE&gt; give every time a person entered the building. (As per your question this is not required, but this will account for scenario when a person went out and came back in. &lt;/LI&gt;
&lt;LI&gt;If you are not using sum(TotalLogins) you will not require fillnull as it puts value as 0 where the same is null.&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;addcoltotals&lt;/CODE&gt; command in the final pipe sums all numeric fields and displays the &lt;CODE&gt;Total&lt;/CODE&gt; value under &lt;CODE&gt;FullName&lt;/CODE&gt; field. &lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 16 Nov 2017 13:36:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363760#M165103</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-16T13:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to work out Total Staff numbers Entering Buildiing Each Day and Weekly Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363761#M165104</link>
      <description>&lt;P&gt;Thanks I was able to change the values of your search and got it running. What I'm being asked for though is a breakdown by day of week totals not each member of staff.&lt;/P&gt;

&lt;P&gt;Week Day----Mon---Tues----Wed----Thurs----Fri----Sat----Sun&lt;BR /&gt;
OfficeA--------200&lt;BR /&gt;
OfficeB---------33&lt;BR /&gt;
Totals-----------233-----333----555------666----765---434-----233&lt;/P&gt;

&lt;P&gt;And a Grand total for each office for whole week.&lt;BR /&gt;
Thanks for your time and help Nik&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 15:43:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363761#M165104</guid>
      <dc:creator>DDewarSplunk</dc:creator>
      <dc:date>2017-11-16T15:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to work out Total Staff numbers Entering Buildiing Each Day and Weekly Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363762#M165105</link>
      <description>&lt;P&gt;Thanks  What I'm being asked for though is a breakdown by day of week totals not each member of staff.&lt;/P&gt;

&lt;P&gt;Week Day----Mon---Tues----Wed----Thurs----Fri----Sat----Sun&lt;BR /&gt;
OfficeA--------200&lt;BR /&gt;
OfficeB---------33&lt;BR /&gt;
Totals-----------233-----333----555------666----765---434-----233&lt;/P&gt;

&lt;P&gt;And a Grand total for each office for whole week.&lt;BR /&gt;
Thanks for your time and help Cmerriman&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 15:43:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363762#M165105</guid>
      <dc:creator>DDewarSplunk</dc:creator>
      <dc:date>2017-11-16T15:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to work out Total Staff numbers Entering Buildiing Each Day and Weekly Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363763#M165106</link>
      <description>&lt;P&gt;Many thanks for your help last week it was very much appreciated.&lt;/P&gt;

&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 09:16:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363763#M165106</guid>
      <dc:creator>DDewarSplunk</dc:creator>
      <dc:date>2017-11-20T09:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to work out Total Staff numbers Entering Buildiing Each Day and Weekly Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363764#M165107</link>
      <description>&lt;P&gt;Many thanks for your help last week&lt;/P&gt;

&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 09:17:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363764#M165107</guid>
      <dc:creator>DDewarSplunk</dc:creator>
      <dc:date>2017-11-20T09:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to work out Total Staff numbers Entering Buildiing Each Day and Weekly Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363765#M165108</link>
      <description>&lt;P&gt;Anytime. Do let us know if you need help with anything else &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 12:04:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-work-out-Total-Staff-numbers-Entering-Buildiing-Each-Day/m-p/363765#M165108</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-20T12:04:55Z</dc:date>
    </item>
  </channel>
</rss>

