<?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 take the result from a timechart 'sum by' and multiply it by another value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-take-the-result-from-a-timechart-sum-by-and-multiply-it/m-p/630514#M219058</link>
    <description>&lt;P&gt;Try this.&amp;nbsp; It cycles through each report class and uses &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; to compute the MSUs used.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=z* MFSOURCETYPE=SMF030 Subtype=2 `calccpusecs`
| where Rptcls IN("RHOTBAT","RPDBATLO","RPDBATMD","RSAGBAT","RTSTBAT")
| eval MSUFactor=(37209.3023/5/216000)
| timechart span=1d sum(cpusecs) by Rptcls
| foreach RHOTBAT RPDBATLO RPDBATMD RSAGBAT RTSTBAT [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;_MSUs=&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; * MSUFactor ]
| addcoltotals&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; Note that &lt;FONT face="courier new,courier"&gt;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;&lt;/FONT&gt; is literal, not a placeholder.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Feb 2023 20:16:47 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-02-10T20:16:47Z</dc:date>
    <item>
      <title>How to take the result from a timechart 'sum by' and multiply it by another value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-take-the-result-from-a-timechart-sum-by-and-multiply-it/m-p/630505#M219056</link>
      <description>&lt;P&gt;Hello, what I am trying to do in this search is sum the total CPU seconds, by report class, for a one day period. Once I have that sum, I would like to take it one step further and multiply that sum by our MSU factor to determine the MSUs used by a specific report class for any given day.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe what I need to do is store the result from the timechart statement as a new variable, to be able to multiply that variable by the MSUFactor. I have not had any luck in&amp;nbsp; trying a combination of 'eval' statements or by leveraging the AS keyword to store the result into a variable I can further work with.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help you may be able to offer!&lt;/P&gt;&lt;P&gt;index=z* MFSOURCETYPE=SMF030 Subtype=2 `calccpusecs`&lt;BR /&gt;| where Rptcls IN("RHOTBAT","RPDBATLO","RPDBATMD","RSAGBAT","RTSTBAT")&lt;BR /&gt;| eval MSUFactor=(37209.3023/5/216000)&lt;BR /&gt;| timechart span=1d sum(cpusecs) by Rptcls&lt;BR /&gt;| addcoltotals&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 19:04:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-take-the-result-from-a-timechart-sum-by-and-multiply-it/m-p/630505#M219056</guid>
      <dc:creator>jhewel2495</dc:creator>
      <dc:date>2023-02-10T19:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to take the result from a timechart 'sum by' and multiply it by another value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-take-the-result-from-a-timechart-sum-by-and-multiply-it/m-p/630514#M219058</link>
      <description>&lt;P&gt;Try this.&amp;nbsp; It cycles through each report class and uses &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; to compute the MSUs used.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=z* MFSOURCETYPE=SMF030 Subtype=2 `calccpusecs`
| where Rptcls IN("RHOTBAT","RPDBATLO","RPDBATMD","RSAGBAT","RTSTBAT")
| eval MSUFactor=(37209.3023/5/216000)
| timechart span=1d sum(cpusecs) by Rptcls
| foreach RHOTBAT RPDBATLO RPDBATMD RSAGBAT RTSTBAT [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;_MSUs=&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; * MSUFactor ]
| addcoltotals&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; Note that &lt;FONT face="courier new,courier"&gt;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;&lt;/FONT&gt; is literal, not a placeholder.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 20:16:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-take-the-result-from-a-timechart-sum-by-and-multiply-it/m-p/630514#M219058</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-02-10T20:16:47Z</dc:date>
    </item>
  </channel>
</rss>

