<?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: Help on calculating statistics in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-on-calculating-statistics/m-p/372623#M109581</link>
    <description>&lt;P&gt;Hi @sashraf thanks for the reply.&lt;BR /&gt;
I had reached until this point earlier, I guess the stats is the easier part. However, the difficulty is I was not able to add a split by clause to get a percentage of the top linked products.&lt;/P&gt;

&lt;P&gt;For example , in my above example look at product 1, it is present in order types a,c,f,g. Now, look at the OTHER products (except product 1) in these 4 orders. 'a' has product type 2 in addition to product type 1, 'c' has product types 4&amp;amp; 5 linked in addition to type 1, 'f' has no other products except type 1, lastly 'g' has type 5 linked other than one.&lt;BR /&gt;
 Hence, the expected recommendation in this case should be something like - 50% of order ids having product code 1 also have product code 5 AND 25% of order ids having product code 1 also have product code 2 &amp;amp; 3. Since order id a has linked products 2 &amp;amp; 4. I am not too worried about the text, but I do need an associated occurrence based count/percentage for the linked products, something like the preceding statement or at least something like&lt;BR /&gt;
&lt;CODE&gt;prd ordr linkedprd linkedprdcount&lt;BR /&gt;
  1     a       5                2&lt;BR /&gt;
         c       2                 1&lt;BR /&gt;
         f       3                 1&lt;BR /&gt;
         g&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 16:22:13 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2018-02-13T16:22:13Z</dc:date>
    <item>
      <title>Help on calculating statistics</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-calculating-statistics/m-p/372621#M109579</link>
      <description>&lt;P&gt;Hi, I have a CSV with something like the one shown. first field is order id and second field is product code.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ordr    prdcd
a              1
a              2
b              3
c             4
c             1
c             5
d             6
d             7
e             2
f             1
g             1
g             5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ask- Look at order id 'a', it has 3 related products 1, 2 &amp;amp; 3. Ask is to find out if an order has a product , then what else could be the products that are usually purchased along with the same product?&lt;BR /&gt;
For example, order ids c &amp;amp; g also have product code 1 , in addition both c and g order codes have linked product code 5, so for order id a, and product code 1 (first row) , we should be able to suggest to include product code 5 to be bundled / offered. However, when we come to the second row, there should be 0/no recommendations since the product code 2 is only being used in order id e  and e in itself does not have any other linked product codes.&lt;BR /&gt;
Another example are rows with order id f and order id c(row order id c product code 1). Here the recommendation should be 50% of order ids having product code 1 also have product code 5 AND 25% of order ids having product code 1 also have product code 2 &amp;amp; 3. Since order id a has linked products 2 &amp;amp; 3&lt;BR /&gt;
I need this kind of recommendations in a third column  for each row&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2018 08:40:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-calculating-statistics/m-p/372621#M109579</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-02-11T08:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help on calculating statistics</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-calculating-statistics/m-p/372622#M109580</link>
      <description>&lt;P&gt;Try appending this to the search that generates the data you have above:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(prdcd) as itemsordered by ordr | stats values(itemsordered) as recommendations by itemsordered | rename itemsordered as prdcd | nomv recommendations
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Without seeing your original source it would be difficult to say for sure, however you would most likely be best to write this to a lookup file (using outputlookup) and keep the file updated via a scheduled search, that way you will be able to add an auto lookup to your original search.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2018 14:44:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-calculating-statistics/m-p/372622#M109580</guid>
      <dc:creator>sashraf</dc:creator>
      <dc:date>2018-02-11T14:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help on calculating statistics</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-calculating-statistics/m-p/372623#M109581</link>
      <description>&lt;P&gt;Hi @sashraf thanks for the reply.&lt;BR /&gt;
I had reached until this point earlier, I guess the stats is the easier part. However, the difficulty is I was not able to add a split by clause to get a percentage of the top linked products.&lt;/P&gt;

&lt;P&gt;For example , in my above example look at product 1, it is present in order types a,c,f,g. Now, look at the OTHER products (except product 1) in these 4 orders. 'a' has product type 2 in addition to product type 1, 'c' has product types 4&amp;amp; 5 linked in addition to type 1, 'f' has no other products except type 1, lastly 'g' has type 5 linked other than one.&lt;BR /&gt;
 Hence, the expected recommendation in this case should be something like - 50% of order ids having product code 1 also have product code 5 AND 25% of order ids having product code 1 also have product code 2 &amp;amp; 3. Since order id a has linked products 2 &amp;amp; 4. I am not too worried about the text, but I do need an associated occurrence based count/percentage for the linked products, something like the preceding statement or at least something like&lt;BR /&gt;
&lt;CODE&gt;prd ordr linkedprd linkedprdcount&lt;BR /&gt;
  1     a       5                2&lt;BR /&gt;
         c       2                 1&lt;BR /&gt;
         f       3                 1&lt;BR /&gt;
         g&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 16:22:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-calculating-statistics/m-p/372623#M109581</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-02-13T16:22:13Z</dc:date>
    </item>
  </channel>
</rss>

