<?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: stats table with individual count and a total count for two fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/stats-table-with-individual-count-and-a-total-count-for-two/m-p/270123#M81280</link>
    <description>&lt;P&gt;Here is how you will get the expected output&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | stats count by state city  | stats values(city) as city values(count) as city_count sum(count) as Total by State
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 05 Feb 2016 03:08:23 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-02-05T03:08:23Z</dc:date>
    <item>
      <title>stats table with individual count and a total count for two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-table-with-individual-count-and-a-total-count-for-two/m-p/270122#M81279</link>
      <description>&lt;P&gt;Hello, &lt;BR /&gt;
 Say I wanted to create a table with the fields State, City, City Count, and Total. If I try to use  &lt;CODE&gt;|stats values(city) as city, count  by State&lt;/CODE&gt; &lt;BR /&gt;
I get a chart that only lists cities, but does not give their individual total, only the total for State. &lt;/P&gt;

&lt;P&gt;Is it possible to get my chart to look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| STATE |      CITY       | city_count|     Total    |
|CA     |   San Jose      |    5      |     15      |
|       | Santa Clara     |    10     |             |
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the last table in the answer here shows it better:  &lt;A href="https://answers.splunk.com/answers/97676/getting-counts-on-multiple-fields-while-grouping-by-one-of-those-fields.html"&gt;https://answers.splunk.com/answers/97676/getting-counts-on-multiple-fields-while-grouping-by-one-of-those-fields.html&lt;/A&gt;  I don't have an "mcount" field, so is this still possible to get the count of each city there? My table would have srcip as State, malware_type as city, and mcount as the total count of each city. &lt;/P&gt;

&lt;P&gt;Also, I tried using the solution using chart shown here: &lt;A href="https://answers.splunk.com/answers/215808/how-to-get-stats-count-results-broken-down-per-fie.html?utm_source=typeahead&amp;amp;utm_medium=newquestion&amp;amp;utm_campaign=no_votes_sort_relev"&gt;https://answers.splunk.com/answers/215808/how-to-get-stats-count-results-broken-down-per-fie.html?utm_source=typeahead&amp;amp;utm_medium=newquestion&amp;amp;utm_campaign=no_votes_sort_relev&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;
however that table is a lot harder to follow(it lists each city as its own column).&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 01:27:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-table-with-individual-count-and-a-total-count-for-two/m-p/270122#M81279</guid>
      <dc:creator>RecoMark0</dc:creator>
      <dc:date>2016-02-05T01:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: stats table with individual count and a total count for two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-table-with-individual-count-and-a-total-count-for-two/m-p/270123#M81280</link>
      <description>&lt;P&gt;Here is how you will get the expected output&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | stats count by state city  | stats values(city) as city values(count) as city_count sum(count) as Total by State
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Feb 2016 03:08:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-table-with-individual-count-and-a-total-count-for-two/m-p/270123#M81280</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-05T03:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: stats table with individual count and a total count for two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-table-with-individual-count-and-a-total-count-for-two/m-p/270124#M81281</link>
      <description>&lt;P&gt;Wow, you are awesome. That worked perfectly. Thank you so much!&lt;/P&gt;</description>
      <pubDate>Sun, 07 Feb 2016 18:41:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-table-with-individual-count-and-a-total-count-for-two/m-p/270124#M81281</guid>
      <dc:creator>RecoMark0</dc:creator>
      <dc:date>2016-02-07T18:41:12Z</dc:date>
    </item>
  </channel>
</rss>

