<?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 How to create a table with several fields and totals by each value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-several-fields-and-totals-by-each/m-p/490013#M136866</link>
    <description>&lt;P&gt;Imagine that I have a table of results like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Field1 Field2 Field3 Field4 Field5 Field6 Field7 Field8 Field9
1     0     1    0     0    3     0      0    3 
1     0     3    1     0    1     1      0    0     
2     0     1    0     1    3     0      0    3 
1     0     3    1     0    1     1      0    1 
3     0     2    0     0    3     0      0    3 
1     0     3    1     0    3     0      0    1 
3     1     1    0     0    1     1      0    3 
0     0     3    1     1    2     1      0    1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For each column I want to have the following statistics:&lt;BR /&gt;
Field1 with 0 Values: 1&lt;BR /&gt;
Field1 with 1 Values: 4&lt;BR /&gt;
Field1 with 2 Values: 2&lt;BR /&gt;
Field1 with 3 Values: 2&lt;BR /&gt;
Field2 with 0 Values: 8&lt;BR /&gt;
Field2 with 1 Values: 1&lt;BR /&gt;
Field2 with 2 Values: 0&lt;BR /&gt;
Field2 with 3 Values: 0&lt;BR /&gt;
Field3 with 0 Values: 0&lt;BR /&gt;
Field3 with 1 Values: 3&lt;BR /&gt;
Field3 with 2 Values: 1&lt;BR /&gt;
Field3 with 3 Values: 4&lt;BR /&gt;
Field4 with 0 Values: 4&lt;BR /&gt;
Field4 with 1 Values: 4&lt;BR /&gt;
Field4 with 2 Values: 0&lt;BR /&gt;
Field4 with 3 Values: 0&lt;BR /&gt;
...&lt;BR /&gt;
until Field9.&lt;/P&gt;

&lt;P&gt;How can I do this? And it´s possible to adapt to a line chart?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;P&gt;Best Regards.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2020 00:01:31 GMT</pubDate>
    <dc:creator>splunk_exercice</dc:creator>
    <dc:date>2020-01-22T00:01:31Z</dc:date>
    <item>
      <title>How to create a table with several fields and totals by each value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-several-fields-and-totals-by-each/m-p/490013#M136866</link>
      <description>&lt;P&gt;Imagine that I have a table of results like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Field1 Field2 Field3 Field4 Field5 Field6 Field7 Field8 Field9
1     0     1    0     0    3     0      0    3 
1     0     3    1     0    1     1      0    0     
2     0     1    0     1    3     0      0    3 
1     0     3    1     0    1     1      0    1 
3     0     2    0     0    3     0      0    3 
1     0     3    1     0    3     0      0    1 
3     1     1    0     0    1     1      0    3 
0     0     3    1     1    2     1      0    1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For each column I want to have the following statistics:&lt;BR /&gt;
Field1 with 0 Values: 1&lt;BR /&gt;
Field1 with 1 Values: 4&lt;BR /&gt;
Field1 with 2 Values: 2&lt;BR /&gt;
Field1 with 3 Values: 2&lt;BR /&gt;
Field2 with 0 Values: 8&lt;BR /&gt;
Field2 with 1 Values: 1&lt;BR /&gt;
Field2 with 2 Values: 0&lt;BR /&gt;
Field2 with 3 Values: 0&lt;BR /&gt;
Field3 with 0 Values: 0&lt;BR /&gt;
Field3 with 1 Values: 3&lt;BR /&gt;
Field3 with 2 Values: 1&lt;BR /&gt;
Field3 with 3 Values: 4&lt;BR /&gt;
Field4 with 0 Values: 4&lt;BR /&gt;
Field4 with 1 Values: 4&lt;BR /&gt;
Field4 with 2 Values: 0&lt;BR /&gt;
Field4 with 3 Values: 0&lt;BR /&gt;
...&lt;BR /&gt;
until Field9.&lt;/P&gt;

&lt;P&gt;How can I do this? And it´s possible to adapt to a line chart?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;P&gt;Best Regards.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 00:01:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-several-fields-and-totals-by-each/m-p/490013#M136866</guid>
      <dc:creator>splunk_exercice</dc:creator>
      <dc:date>2020-01-22T00:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with several fields and totals by each value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-several-fields-and-totals-by-each/m-p/490014#M136867</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="Field1,Field2,Field3,Field4,Field5,Field6,Field7,Field8,Field9
1,0,1,0,0,3,0,0,3
1,0,3,1,0,1,1,0,0
2,0,1,0,1,3,0,0,3
1,0,3,1,0,1,1,0,1
3,0,2,0,0,3,0,0,3
1,0,3,1,0,3,0,0,1
3,1,1,0,0,1,1,0,3
0,0,3,1,1,2,1,0,1" 
| multikv forceheader=1 
| table Field1,Field2,Field3,Field4,Field5,Field6,Field7,Field8,Field9 
`comment("this is your sample")`
`comment("from here , the logic")`
| eval tmp=1 
| untable tmp field_name value 
| eventstats count(eval(value=0)) as with0 count(eval(value=1)) as with1,
    count(eval(value=2)) as with2 count(eval(value=3)) as with3 by field_name 
| table field_name with* 
`comment("I think above is enough, but as you want, i do")`
| untable field_name with_number value 
| rex field=with_number mode=sed "s/with(\d)/with \1/" 
| eval value = "value: ".value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, @splunk_exercice&lt;BR /&gt;
How about this?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 02:21:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-several-fields-and-totals-by-each/m-p/490014#M136867</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-22T02:21:48Z</dc:date>
    </item>
  </channel>
</rss>

