<?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 get event counts for multiple fields grouped by another field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-counts-for-multiple-fields-grouped-by-another/m-p/228966#M67759</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;searchHere | chart  count BY account cust_action
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 25 Jun 2016 02:39:30 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2016-06-25T02:39:30Z</dc:date>
    <item>
      <title>How to get event counts for multiple fields grouped by another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-counts-for-multiple-fields-grouped-by-another/m-p/228964#M67757</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;New to Splunk and been trying to figure out this for a while now.  Not making much progress, so thought I'd ask the experts.  I would like to count events for two fields grouped by another field.  &lt;/P&gt;

&lt;P&gt;Right now, if I run the following command, I get the results I'm looking for, but the way they are being displayed is not exactly how I would like it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;searchHere | stats count as total by cust_action, account | stats values(cust_action) AS action, values(total) by account
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This provides me something like shown below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; account      action           total
 userA      submitted       4
              resubmitted     1
 userB      submitted       1
              resubmitted      0
 userC      submitted       1
              resubmitted     3
              cancelled     1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I would like to do is have the column name in the results be the value from cust_action field and put the count below each one by per account&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;account     submitted     resubmitted     cancelled
userA      4             1               0

userB      1             0               0

userC      1             3               1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for the help in advanced.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 15:19:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-counts-for-multiple-fields-grouped-by-another/m-p/228964#M67757</guid>
      <dc:creator>splunker1981</dc:creator>
      <dc:date>2016-06-24T15:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to get event counts for multiple fields grouped by another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-counts-for-multiple-fields-grouped-by-another/m-p/228965#M67758</link>
      <description>&lt;P&gt;This should do it&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;searchHere | chart count as total over account by cust_action
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2016 15:25:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-counts-for-multiple-fields-grouped-by-another/m-p/228965#M67758</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-24T15:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get event counts for multiple fields grouped by another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-counts-for-multiple-fields-grouped-by-another/m-p/228966#M67759</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;searchHere | chart  count BY account cust_action
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Jun 2016 02:39:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-counts-for-multiple-fields-grouped-by-another/m-p/228966#M67759</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-06-25T02:39:30Z</dc:date>
    </item>
  </channel>
</rss>

