<?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 append column total to column name? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469501#M192061</link>
    <description>&lt;P&gt;@kamlesh_vaghela Thanks for responding but, it does not work.&lt;/P&gt;

&lt;P&gt;I am getting something like this.&lt;/P&gt;

&lt;P&gt;Name    row 1   row 2   row 3&lt;BR /&gt;
AE            2            0                   2&lt;BR /&gt;
AT            5            0                   6&lt;BR /&gt;
AU            2            0                    3&lt;BR /&gt;
BE            6            0                    6&lt;BR /&gt;
BR          24             0                    31&lt;/P&gt;

&lt;P&gt;I already tried something similar, I think I am missing something, Thanks! &lt;/P&gt;</description>
    <pubDate>Fri, 25 Oct 2019 17:38:06 GMT</pubDate>
    <dc:creator>sandeepmakkena</dc:creator>
    <dc:date>2019-10-25T17:38:06Z</dc:date>
    <item>
      <title>How to append column total to column name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469499#M192059</link>
      <description>&lt;P&gt;I have data something like this &lt;/P&gt;

&lt;P&gt;Name.          Accepted          Rejected      Posted       Total&lt;/P&gt;

&lt;P&gt;Change            3                        5                    7               15&lt;BR /&gt;
NOC                 5                        6                    5                16&lt;BR /&gt;
                         8                       11                   12              21&lt;/P&gt;

&lt;P&gt;Which I am getting by this command &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index=#####
| chart dc(TID) as count by Name Status
| addtotals 
| addcolTotals
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I wanted is &lt;BR /&gt;
Name.          Accepted(8)          Rejected(11)      Posted(12)       Total(21)&lt;/P&gt;

&lt;P&gt;Change            3                                 5                          7                    15&lt;BR /&gt;
NOC                 5                                 6                           5                   16&lt;BR /&gt;
                         8                                 11                        12                   21&lt;BR /&gt;
I did try &lt;CODE&gt;| eval status=status."(".count.")"&lt;/CODE&gt;&lt;BR /&gt;
Thanks for your time!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 05:22:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469499#M192059</guid>
      <dc:creator>sandeepmakkena</dc:creator>
      <dc:date>2019-10-25T05:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to append column total to column name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469500#M192060</link>
      <description>&lt;P&gt;@sandeepmakkena &lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; Index=#####
 | chart dc(TID) as count by Name Status
 | addtotals 
| table Name Accepted Rejected Posted Total | addcolTotals labelfield=Name label="my_total" | transpose header_field=Name | eval column=column."(".my_total.")" | transpose header_field=column  | rename column as Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval _raw="Name Accepted Rejected Posted Total
Change 3 5 7 15
NOC 5 6 5 16" | multikv | table Name Accepted Rejected Posted Total | addcolTotals labelfield=Name label="my_total" | transpose header_field=Name | eval column=column."(".my_total.")" | transpose header_field=column  | rename column as Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note:  You can remove &lt;CODE&gt;| table Name Accepted Rejected Posted Total&lt;/CODE&gt; if the sequence of fields is the same. &lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 06:33:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469500#M192060</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-10-25T06:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to append column total to column name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469501#M192061</link>
      <description>&lt;P&gt;@kamlesh_vaghela Thanks for responding but, it does not work.&lt;/P&gt;

&lt;P&gt;I am getting something like this.&lt;/P&gt;

&lt;P&gt;Name    row 1   row 2   row 3&lt;BR /&gt;
AE            2            0                   2&lt;BR /&gt;
AT            5            0                   6&lt;BR /&gt;
AU            2            0                    3&lt;BR /&gt;
BE            6            0                    6&lt;BR /&gt;
BR          24             0                    31&lt;/P&gt;

&lt;P&gt;I already tried something similar, I think I am missing something, Thanks! &lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 17:38:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469501#M192061</guid>
      <dc:creator>sandeepmakkena</dc:creator>
      <dc:date>2019-10-25T17:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to append column total to column name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469502#M192062</link>
      <description>&lt;P&gt;Here is a run-anywhere example that does it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* 
| rename component AS Status, sourcetype AS Name
| chart useother=f usenull=f limit=3 count BY Name Status 

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| addtotals row=t col=t
| eval Name=coalesce(Name, "Grand Totals")
| rename Name AS _Name
| eventstats max(*) AS total_*
| foreach total_* [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = "&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;(" . &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; . ")", {&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;} = &amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt; | fields - &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; &amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt; ]
| rename _Name AS Name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Oct 2019 17:41:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469502#M192062</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-10-25T17:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to append column total to column name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469503#M192063</link>
      <description>&lt;P&gt;This is wonderful @woodcock, Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 18:22:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-append-column-total-to-column-name/m-p/469503#M192063</guid>
      <dc:creator>sandeepmakkena</dc:creator>
      <dc:date>2019-10-25T18:22:25Z</dc:date>
    </item>
  </channel>
</rss>

