<?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 Help with eval division calculation in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-eval-division-calculation/m-p/403972#M116869</link>
    <description>&lt;P&gt;Hey all,&lt;/P&gt;

&lt;P&gt;I need an eval expression for the below output:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;_time minutes bminutes&lt;BR /&gt;
2019-06-01  1349511.54  105472800&lt;BR /&gt;
2019-06-08  1498691.33  105472800&lt;BR /&gt;
2019-06-15  1447368.29  105472800&lt;BR /&gt;
2019-06-22  1379824.64  105472800&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;It is by every week so I need an eval expression from which I can divide every row of minutes by bminutes by time.&lt;/P&gt;

&lt;P&gt;Expected results:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;_time minutes bminutes result&lt;BR /&gt;
2019-06-01  1349511.54  105472800 1.279&lt;BR /&gt;
2019-06-08  1498691.33  105472800 1.420&lt;BR /&gt;
2019-06-15  1447368.29  105472800 1.372&lt;BR /&gt;
2019-06-22  1379824.64  105472800 1.308&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2019 21:52:37 GMT</pubDate>
    <dc:creator>splunkuseradmin</dc:creator>
    <dc:date>2019-07-22T21:52:37Z</dc:date>
    <item>
      <title>Help with eval division calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-eval-division-calculation/m-p/403972#M116869</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;

&lt;P&gt;I need an eval expression for the below output:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;_time minutes bminutes&lt;BR /&gt;
2019-06-01  1349511.54  105472800&lt;BR /&gt;
2019-06-08  1498691.33  105472800&lt;BR /&gt;
2019-06-15  1447368.29  105472800&lt;BR /&gt;
2019-06-22  1379824.64  105472800&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;It is by every week so I need an eval expression from which I can divide every row of minutes by bminutes by time.&lt;/P&gt;

&lt;P&gt;Expected results:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;_time minutes bminutes result&lt;BR /&gt;
2019-06-01  1349511.54  105472800 1.279&lt;BR /&gt;
2019-06-08  1498691.33  105472800 1.420&lt;BR /&gt;
2019-06-15  1447368.29  105472800 1.372&lt;BR /&gt;
2019-06-22  1379824.64  105472800 1.308&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 21:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-eval-division-calculation/m-p/403972#M116869</guid>
      <dc:creator>splunkuseradmin</dc:creator>
      <dc:date>2019-07-22T21:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help with eval division calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-eval-division-calculation/m-p/403973#M116870</link>
      <description>&lt;P&gt;I'm afraid I couldn't understand properly what your exact requirement is &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
However, this gives your desired output with a slight change&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | fields - _time | eval data="2019-06-01 1349511.54 105472800|2019-06-08 1498691.33 105472800|2019-06-15 1447368.29 105472800|2019-06-22 1379824.64 105472800" | makemv delim="|" data | mvexpand data | rex field=data "^(?&amp;lt;_time&amp;gt;[^\s]*)\s(?&amp;lt;minutes&amp;gt;[^\s]*)\s(?&amp;lt;bizMinutes&amp;gt;[^\s]*)$" | table _time, minutes, bizMinutes | eval result=round(100*minutes/bizMinutes,3)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Jul 2019 23:19:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-eval-division-calculation/m-p/403973#M116870</guid>
      <dc:creator>nabeel652</dc:creator>
      <dc:date>2019-07-22T23:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with eval division calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-eval-division-calculation/m-p/403974#M116871</link>
      <description>&lt;P&gt;| eval result=round(100*minutes/bizMinutes,3)&lt;/P&gt;

&lt;P&gt;this will give you 3 trailing digits after decimal&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 10:35:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-eval-division-calculation/m-p/403974#M116871</guid>
      <dc:creator>ayush1906</dc:creator>
      <dc:date>2019-07-23T10:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help with eval division calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-eval-division-calculation/m-p/403975#M116872</link>
      <description>&lt;P&gt;You just spelled your field wrong (using &lt;CODE&gt;m&lt;/CODE&gt; instead of &lt;CODE&gt;M&lt;/CODE&gt; in the &lt;CODE&gt;bizMinutes&lt;/CODE&gt; field); see the last line in this working run-anywhere example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="time=2019-06-01,minutes=1349511.54,bizMinutes=105472800 time=2019-06-08,minutes=1498691.33,bizMinutes=105472800 time=2019-06-15,minutes=1447368.29,bizMinutes=105472800 time=2019-06-22,minutes=1379824.64,bizMinutes=105472800" 
| makemv raw 
| mvexpand raw 
| rename raw AS _raw 
| kv 
| eval _time = strptime(time, "%Y-%m-%d") 
| fields - time 
| eval result = round(100 * minutes / bizMinutes)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Jul 2019 19:21:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-eval-division-calculation/m-p/403975#M116872</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-27T19:21:56Z</dc:date>
    </item>
  </channel>
</rss>

