<?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 calculate through elements in MV field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-through-elements-in-MV-field/m-p/625026#M217270</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245586"&gt;@DS904458&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use this eval on your example table data, which will create calc_output as in your example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval calc_output=sum(mvmap(result_mv, pow((test_result-result_mv),2)))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If you want to then get totals by product_name, use eventstats or stats as needed.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Dec 2022 23:27:24 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2022-12-21T23:27:24Z</dc:date>
    <item>
      <title>How to calculate through elements in MV field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-through-elements-in-MV-field/m-p/624945#M217248</link>
      <description>&lt;P&gt;I have a table like this&lt;/P&gt;&lt;TABLE border="1" width="63.99957012761994%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;product_name&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;test_result&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;result_mv&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;calc_output&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;A&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;1&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;A&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;2&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;A&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;3&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;B&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;4&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;4&lt;BR /&gt;6&lt;BR /&gt;7&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;B&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;6&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;4&lt;BR /&gt;6&lt;BR /&gt;7&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;B&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;7&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;4&lt;BR /&gt;6&lt;BR /&gt;7&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see thr MV&amp;nbsp;field "result_mv".&lt;BR /&gt;Is the outcome of&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;| eventstats list(test_result) by product_name&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;And I have a customized func, for example:&lt;BR /&gt;&lt;SPAN&gt;Σ&lt;/SPAN&gt;( ( test_result -&amp;nbsp;result_mv[index] ) ^2)&lt;/P&gt;&lt;P&gt;Example of function output (calc_output):&lt;BR /&gt;(1-1)^2 + (1-2)^2 + (1-3)^2 = 0+1+4 = 5&lt;BR /&gt;(2-1)^2 + (2-2)^2 + (2-3)^2 = 1+0+1 = 2&lt;BR /&gt;(3-1)^2 + (3-2)^2 + (3-3)^2 = 4+1+0 = 5&lt;/P&gt;&lt;P&gt;(4-4)^2 + (4-6)^2 + (4-7)^2 = 0+4+9 = 13&lt;BR /&gt;(6-4)^2 + (6-6)^2 + (6-7)^2 = 4+0+1 = 5&lt;BR /&gt;(7-4)^2 + (7-6)^2 + (7-7)^2 = 9+1+0 = 10&lt;BR /&gt;&lt;BR /&gt;Bottom line, I need create the "calc_output" through "result_mv" by "product_name" .&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 09:35:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-through-elements-in-MV-field/m-p/624945#M217248</guid>
      <dc:creator>DS904458</dc:creator>
      <dc:date>2022-12-21T09:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate through elements in MV field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-through-elements-in-MV-field/m-p/625026#M217270</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245586"&gt;@DS904458&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use this eval on your example table data, which will create calc_output as in your example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval calc_output=sum(mvmap(result_mv, pow((test_result-result_mv),2)))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If you want to then get totals by product_name, use eventstats or stats as needed.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 23:27:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-through-elements-in-MV-field/m-p/625026#M217270</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-12-21T23:27:24Z</dc:date>
    </item>
  </channel>
</rss>

