<?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: using addcoltotals in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/using-addcoltotals/m-p/653845#M225964</link>
    <description>&lt;P&gt;You can't use the total calculated by addcoltotals as it's in a new row at the bottom of the table, however, as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;the typical way to calculate percentages is to use eventstats to add up all the counts, so that the total is added to _every_ row in your data set, which you can then calculate the percentages with.&lt;/P&gt;&lt;P&gt;Then discard that calculated total field if you no longer need it&lt;/P&gt;</description>
    <pubDate>Thu, 10 Aug 2023 06:26:26 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2023-08-10T06:26:26Z</dc:date>
    <item>
      <title>using addcoltotals</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-addcoltotals/m-p/653820#M225953</link>
      <description>&lt;P&gt;Can you leverage the total derived using the addcoltotals command to support other calculations? i.e. can you use it to calculate a percentage?&amp;nbsp;&lt;/P&gt;&lt;P&gt;| addcoltotals count labelfield="total"&lt;BR /&gt;| eval percent=((count/total)*100)&lt;BR /&gt;| table host count percent&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 20:24:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-addcoltotals/m-p/653820#M225953</guid>
      <dc:creator>dolj</dc:creator>
      <dc:date>2023-08-09T20:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: using addcoltotals</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-addcoltotals/m-p/653822#M225954</link>
      <description>&lt;P&gt;Yes, the output of the &lt;FONT face="courier new,courier"&gt;addcoltotals&lt;/FONT&gt; command can be used to perform calculations.&amp;nbsp; The sample code, however, won't work.&amp;nbsp; That's because the value of the "total" field created by &lt;FONT face="courier new,courier"&gt;addcoltotals&lt;/FONT&gt; is text (the label) rather than a number so the &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; will fail.&lt;/P&gt;&lt;P&gt;Another way to get percentages is to use &lt;FONT face="courier new,courier"&gt;eventstats&lt;/FONT&gt; to compute the total then &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; the percentage.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eventstats sum(count) as total
| eval percent=((count/total)*100)
| table host count percent&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 20:41:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-addcoltotals/m-p/653822#M225954</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-08-09T20:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: using addcoltotals</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-addcoltotals/m-p/653845#M225964</link>
      <description>&lt;P&gt;You can't use the total calculated by addcoltotals as it's in a new row at the bottom of the table, however, as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;the typical way to calculate percentages is to use eventstats to add up all the counts, so that the total is added to _every_ row in your data set, which you can then calculate the percentages with.&lt;/P&gt;&lt;P&gt;Then discard that calculated total field if you no longer need it&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 06:26:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-addcoltotals/m-p/653845#M225964</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-08-10T06:26:26Z</dc:date>
    </item>
  </channel>
</rss>

