<?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 do the division of 2 values in the same field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/598478#M208400</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;When doing it, I have this error:&amp;nbsp;Error in 'eval' command: Type checking failed. '*' only takes numbers.&lt;BR /&gt;&lt;BR /&gt;And I have to define 2 variable to store each value and it works.... Do you know why?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats list(value) as value
|eval n= mvindex(value,3)
|eval m= mvindex(value,2)
|eval percent=100*n/m&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2022 12:46:19 GMT</pubDate>
    <dc:creator>Julia1231</dc:creator>
    <dc:date>2022-05-19T12:46:19Z</dc:date>
    <item>
      <title>How to do the division of 2 values in the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/596745#M207727</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a table like this:&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;value&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;I want to do this calculation by splunk: (10/12)*100% (means value&amp;nbsp; of second id / value of the first id)*100%&lt;/P&gt;&lt;P&gt;How do I do, please?&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 14:24:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/596745#M207727</guid>
      <dc:creator>Julia1231</dc:creator>
      <dc:date>2022-05-06T14:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to do the division of 2 values in the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/596747#M207728</link>
      <description>&lt;P&gt;Calculations are done between fields in events so the first thing you need to do is get both values into the same event. There a number of ways to do this. If you only have two events, try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats list(value) as value
| eval percent=100*mvindex(value,1)/mvindex(value,0)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 06 May 2022 15:08:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/596747#M207728</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-06T15:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to do the division of 2 values in the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/596898#M207769</link>
      <description>&lt;P&gt;It works well,&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 08:36:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/596898#M207769</guid>
      <dc:creator>Julia1231</dc:creator>
      <dc:date>2022-05-09T08:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to do the division of 2 values in the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/598464#M208397</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;What can I do when there are more than 2 values, please?&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;value&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 15&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 10:08:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/598464#M208397</guid>
      <dc:creator>Julia1231</dc:creator>
      <dc:date>2022-05-19T10:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to do the division of 2 values in the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/598465#M208398</link>
      <description>&lt;P&gt;mvindex uses index into the multivalue field, starting at 0, so if you wanted to calculate the percentage for id 3 and 4 you would do something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats list(value) as value
| eval percent=100*mvindex(value,3)/mvindex(value,2)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 May 2022 10:34:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/598465#M208398</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-19T10:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to do the division of 2 values in the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/598478#M208400</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;When doing it, I have this error:&amp;nbsp;Error in 'eval' command: Type checking failed. '*' only takes numbers.&lt;BR /&gt;&lt;BR /&gt;And I have to define 2 variable to store each value and it works.... Do you know why?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats list(value) as value
|eval n= mvindex(value,3)
|eval m= mvindex(value,2)
|eval percent=100*n/m&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 12:46:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/598478#M208400</guid>
      <dc:creator>Julia1231</dc:creator>
      <dc:date>2022-05-19T12:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to do the division of 2 values in the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/598482#M208401</link>
      <description>&lt;P&gt;mvindex is probably returning a string so either do it the way you are or use the tonumber function&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats list(value) as value
|eval percent=100*tonumber(mvindex(value,3))/tonumber(mvindex(value,2))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 May 2022 13:07:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-the-division-of-2-values-in-the-same-field/m-p/598482#M208401</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-19T13:07:28Z</dc:date>
    </item>
  </channel>
</rss>

