<?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: Combine features from both stats and chart command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combine-features-from-both-stats-and-chart-command/m-p/74048#M18605</link>
    <description>&lt;P&gt;This is great&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2013 16:37:18 GMT</pubDate>
    <dc:creator>cmak</dc:creator>
    <dc:date>2013-03-26T16:37:18Z</dc:date>
    <item>
      <title>Combine features from both stats and chart command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-features-from-both-stats-and-chart-command/m-p/74046#M18603</link>
      <description>&lt;P&gt;My fields in this example are (row, column, data and count)&lt;/P&gt;

&lt;P&gt;I want to combine the features of this command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;chart sum(count) by row, column
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This would make something like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  column1 column2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;row1  2        2 &lt;BR /&gt;
row2  3        1&lt;/P&gt;

&lt;P&gt;with&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;stats sum(count) by row,data
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This could create:&lt;BR /&gt;
               sum(count)&lt;BR /&gt;
row1  data1         1 &lt;BR /&gt;
row1  data2        1&lt;BR /&gt;
row2  data1         3 &lt;BR /&gt;
row2  data2        4&lt;/P&gt;

&lt;P&gt;What I want is the combination:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;           column1   column2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;row1  data1         1      2&lt;BR /&gt;
row1  data2        1       2&lt;BR /&gt;
row2  data1         3      5&lt;BR /&gt;
row2  data2        4       4&lt;/P&gt;

&lt;P&gt;where the columns (column 1 and 2) are dynamic - All possible values of field column&lt;/P&gt;

&lt;P&gt;In short, I would like to split by multiple fields, but also create a matrix with another particular field.&lt;/P&gt;

&lt;P&gt;I suppose I could also try stats sum(eval(column="column1")), but I cannot find a way sum the count field with an eval statement. if there is a way to do this, I can dynamically generate the query with a long line of sum(eval) statements.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 20:23:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-features-from-both-stats-and-chart-command/m-p/74046#M18603</guid>
      <dc:creator>cmak</dc:creator>
      <dc:date>2013-03-25T20:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Combine features from both stats and chart command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-features-from-both-stats-and-chart-command/m-p/74047#M18604</link>
      <description>&lt;P&gt;the &lt;CODE&gt;xyseries&lt;/CODE&gt; command can turn a stats-style result set into the equivalent chart-style one,  but since you can only specify one group-by field (the docs call it an x-field),  you have to use eval to glom your unique combinations into a single field, wash it through xyseries, and then split it apart again after. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | stats sum(count) by row data column | eval combined=row+"_"+data | xyseries combined column sum(count) | eval row=mvindex(split(combined,"_"),0) | eval data=mvindex(split(combined,"_"),1) | fields - combined | fields row data *&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;xyseries docs:  &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Xyseries"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Xyseries&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 07:52:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-features-from-both-stats-and-chart-command/m-p/74047#M18604</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-03-26T07:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Combine features from both stats and chart command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-features-from-both-stats-and-chart-command/m-p/74048#M18605</link>
      <description>&lt;P&gt;This is great&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 16:37:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-features-from-both-stats-and-chart-command/m-p/74048#M18605</guid>
      <dc:creator>cmak</dc:creator>
      <dc:date>2013-03-26T16:37:18Z</dc:date>
    </item>
  </channel>
</rss>

