<?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: Weighted Sum in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479601#M134417</link>
    <description>&lt;P&gt;Thanks so much! It worked &lt;/P&gt;</description>
    <pubDate>Fri, 08 Nov 2019 08:59:44 GMT</pubDate>
    <dc:creator>cafan</dc:creator>
    <dc:date>2019-11-08T08:59:44Z</dc:date>
    <item>
      <title>Weighted Sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479598#M134414</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm new to splunk and am hoping to get some advice and help. &lt;/P&gt;

&lt;P&gt;I'm trying to do a addcoltotals but with different weights for each row. After a table function my data looks like:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Size&lt;/STRONG&gt;               &lt;STRONG&gt;Index&lt;/STRONG&gt;&lt;BR /&gt;
Large            0.45&lt;BR /&gt;
Medium       0.7&lt;BR /&gt;
Small            0.9&lt;/P&gt;

&lt;P&gt;I want to do a weighted summation with specific values (I've bolded them below - these values are constant): &lt;/P&gt;

&lt;P&gt;totalIndex = &lt;STRONG&gt;0.2&lt;/STRONG&gt;  X (Index[Size="Large"])+ &lt;STRONG&gt;0.7&lt;/STRONG&gt; X (Index[Size="Medium"]) + &lt;STRONG&gt;0.1&lt;/STRONG&gt; X (Index[Size="Small"])&lt;/P&gt;

&lt;P&gt;After I should have one stat value = 0.2 X 0.45 + 0.7 X 0.7 + 0.1 X 0.9 = &lt;STRONG&gt;0.67&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 15:26:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479598#M134414</guid>
      <dc:creator>cafan</dc:creator>
      <dc:date>2019-11-07T15:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479599#M134415</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;table with Size and Index&amp;gt;| foreach Size 
    [ eval Index=case(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=="Large",round(Index*0.2,3),&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=="Medium",round(Index*0.7,3),&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=="Small",round(Index*0.1,3))] 
|  stats sum(Index)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;simple&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table Size Index 
| eval Index=case(Size=="Large",round(Index*0.2,2),Size=="Medium",round(Index*0.7,2),Size=="Small",round(Index*0.1,2)) 
| stats sum(Index)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Nov 2019 17:21:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479599#M134415</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-07T17:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479600#M134416</link>
      <description>&lt;P&gt;try this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval w_Index= Index*case(Size=="Large", 0.2, Size=="Medium", 0.7, Size=="Small", 0.1) 
| addcoltotals
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you don't need the original Index values&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Index= Index*case(Size=="Large", 0.2, Size=="Medium", 0.7, Size=="Small", 0.1) 
| addcoltotals
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Nov 2019 17:41:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479600#M134416</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-11-07T17:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479601#M134417</link>
      <description>&lt;P&gt;Thanks so much! It worked &lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 08:59:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479601#M134417</guid>
      <dc:creator>cafan</dc:creator>
      <dc:date>2019-11-08T08:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted Sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479602#M134418</link>
      <description>&lt;P&gt;Thank you! &lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 08:59:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Weighted-Sum/m-p/479602#M134418</guid>
      <dc:creator>cafan</dc:creator>
      <dc:date>2019-11-08T08:59:56Z</dc:date>
    </item>
  </channel>
</rss>

