<?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 How do I multiply 3 row values from 1 column and do it in one cell using append pipe. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335590#M99662</link>
    <description>&lt;P&gt;This is my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
 | eval data = "
 1  2017-12 A   155749  131033  84.1;
2   2017-12 B   24869   23627   95;
3   2017-12 C   117618  117185  99.6;
" 
 | makemv delim=";" data 
 | mvexpand data
 | rex field=data "(?&amp;lt;serial&amp;gt;\d)\s+(?&amp;lt;date&amp;gt;\d+-\d+)\s+(?&amp;lt;type&amp;gt;\w)\s+(?&amp;lt;attempts&amp;gt;\d+)\s+(?&amp;lt;successfullAttempts&amp;gt;\d+)\s+(?&amp;lt;sr&amp;gt;\d+)"
 | fields + date serial type attempts successfullAttempts sr 
 | rename date as _time 
 | search serial=*
 | appendpipe [stats avg(sr) as sr | eval sr=round(sr,1) | eval successfullAttempts="average sr"]  
 | appendpipe [stats sum(sr) as sr | eval sr=round(sr,1) ]
 | appendpipe [ where type="A" | stats sum(sr) as sr ]  
 | appendpipe [ where type="B" | stats sum(sr) as sr ]  
 | appendpipe [ where type="C" | stats sum(sr) as sr ] 
 | appendpipe [ stats sum(sr) as sr | eval sr="want 84*95*99 to go here" ] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is my result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   serial  type    attempts    successfullAttempts sr
1   2017-12 1   A   155749  131033  84
2   2017-12 2   B   24869   23627   95
3   2017-12 3   C   117618  117185  99
4                   average sr  92.7
5                       370.7
6                       84
7                       95
8                       99
9                       want 84*95*99 to go here
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I want is in row 9 column sr the result fo 84*95*99&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    _time   serial  type    attempts    successfullAttempts sr
1   2017-12 1   A   155749  131033  84
2   2017-12 2   B   24869   23627   95
3   2017-12 3   C   117618  117185  99
4                   average sr  92.7
5                       370.7
6                       84
7                       95
8                       99
9                       790020
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;How can I do this?&lt;/STRONG&gt;&lt;BR /&gt;
&lt;STRONG&gt;How do I multiply 3 row values from 1 column and do it in one cell using append pipe.&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 17:50:58 GMT</pubDate>
    <dc:creator>HattrickNZ</dc:creator>
    <dc:date>2020-09-29T17:50:58Z</dc:date>
    <item>
      <title>How do I multiply 3 row values from 1 column and do it in one cell using append pipe.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335590#M99662</link>
      <description>&lt;P&gt;This is my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
 | eval data = "
 1  2017-12 A   155749  131033  84.1;
2   2017-12 B   24869   23627   95;
3   2017-12 C   117618  117185  99.6;
" 
 | makemv delim=";" data 
 | mvexpand data
 | rex field=data "(?&amp;lt;serial&amp;gt;\d)\s+(?&amp;lt;date&amp;gt;\d+-\d+)\s+(?&amp;lt;type&amp;gt;\w)\s+(?&amp;lt;attempts&amp;gt;\d+)\s+(?&amp;lt;successfullAttempts&amp;gt;\d+)\s+(?&amp;lt;sr&amp;gt;\d+)"
 | fields + date serial type attempts successfullAttempts sr 
 | rename date as _time 
 | search serial=*
 | appendpipe [stats avg(sr) as sr | eval sr=round(sr,1) | eval successfullAttempts="average sr"]  
 | appendpipe [stats sum(sr) as sr | eval sr=round(sr,1) ]
 | appendpipe [ where type="A" | stats sum(sr) as sr ]  
 | appendpipe [ where type="B" | stats sum(sr) as sr ]  
 | appendpipe [ where type="C" | stats sum(sr) as sr ] 
 | appendpipe [ stats sum(sr) as sr | eval sr="want 84*95*99 to go here" ] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is my result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   serial  type    attempts    successfullAttempts sr
1   2017-12 1   A   155749  131033  84
2   2017-12 2   B   24869   23627   95
3   2017-12 3   C   117618  117185  99
4                   average sr  92.7
5                       370.7
6                       84
7                       95
8                       99
9                       want 84*95*99 to go here
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I want is in row 9 column sr the result fo 84*95*99&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    _time   serial  type    attempts    successfullAttempts sr
1   2017-12 1   A   155749  131033  84
2   2017-12 2   B   24869   23627   95
3   2017-12 3   C   117618  117185  99
4                   average sr  92.7
5                       370.7
6                       84
7                       95
8                       99
9                       790020
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;How can I do this?&lt;/STRONG&gt;&lt;BR /&gt;
&lt;STRONG&gt;How do I multiply 3 row values from 1 column and do it in one cell using append pipe.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:50:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335590#M99662</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2020-09-29T17:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I multiply 3 row values from 1 column and do it in one cell using append pipe.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335591#M99663</link>
      <description>&lt;P&gt;hey you can try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
  | eval data = "
  1    2017-12    A    155749    131033    84.1;
 2    2017-12    B    24869    23627    95;
 3    2017-12    C    117618    117185    99.6;
 " 
  | makemv delim=";" data 
  | mvexpand data
  | rex field=data "(?&amp;lt;serial&amp;gt;\d)\s+(?&amp;lt;date&amp;gt;\d+-\d+)\s+(?&amp;lt;type&amp;gt;\w)\s+(?&amp;lt;attempts&amp;gt;\d+)\s+(?&amp;lt;successfullAttempts&amp;gt;\d+)\s+(?&amp;lt;sr&amp;gt;\d+)"
  | fields + date serial type attempts successfullAttempts sr 
  | rename date as _time 
  | search serial=*
  | appendpipe [stats avg(sr) as sr | eval sr=round(sr,1) | eval successfullAttempts="average sr"]  
  | appendpipe [stats sum(sr) as sr | eval sr=round(sr,1) ]
  | appendpipe [ where type="A" | stats sum(sr) as sr ]  
  | appendpipe [ where type="B" | stats sum(sr) as sr ]  
  | appendpipe [ where type="C" | stats sum(sr) as sr ]| appendpipe [ stats values(sr) as sr by type | transpose 0 header_field=type  | eval sr=A*B*C | fields sr ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 03:09:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335591#M99663</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-26T03:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I multiply 3 row values from 1 column and do it in one cell using append pipe.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335592#M99664</link>
      <description>&lt;P&gt;Try this!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(your search)
  | appendpipe [ where type="A" OR type="B" OR type="C" |stats values(sr) as sr 
  | eval a=tonumber(mvindex(sr,0))*tonumber(mvindex(sr,1))*tonumber(mvindex(sr,2))|rename a as sr]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Jan 2018 03:09:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335592#M99664</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2018-01-26T03:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I multiply 3 row values from 1 column and do it in one cell using append pipe.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335593#M99665</link>
      <description>&lt;P&gt;Maybe not the best thing to do, it's hard to do multiplications of rows in splunk.&lt;BR /&gt;
A possible workaround is to delete all the previous lines, then do a transpose of the  3 lines (to make them columns)&lt;BR /&gt;
then use eval to multiply them.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      | makeresults 
      | eval data = "
      1    2017-12    A    155749    131033    84.1;
     2    2017-12    B    24869    23627    95;
     3    2017-12    C    117618    117185    99.6;
     " 
      | makemv delim=";" data 
      | mvexpand data
      | rex field=data "(?&amp;lt;serial&amp;gt;\d)\s+(?&amp;lt;date&amp;gt;\d+-\d+)\s+(?&amp;lt;type&amp;gt;\w)\s+(?&amp;lt;attempts&amp;gt;\d+)\s+(?&amp;lt;successfullAttempts&amp;gt;\d+)\s+(?&amp;lt;sr&amp;gt;\d+)"
      | fields + date serial type attempts successfullAttempts sr 
      | rename date as _time 
      | search serial=*
      | appendpipe [stats avg(sr) as sr | eval sr=round(sr,1) | eval successfullAttempts="average sr"]  
      | appendpipe [stats sum(sr) as sr | eval sr=round(sr,1) ]
      | appendpipe [ where type="A" | stats sum(sr) as srvalue | eval srtitle="srA" ]  
      | appendpipe [ where type="B" | stats sum(sr) as srvalue | eval srtitle="srB"]  
      | appendpipe [ where type="C" | stats sum(sr) as srvalue | eval srtitle="srC"]
      | table srtitle srvalue
      | transpose 20 header_field=srtitle
      | eval sr_calcul=srA*srB*srC
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;will return something like :&lt;BR /&gt;
column  row 1   row 2   row 3   row 4   row 5   srA srB srC sr_calcul&lt;BR /&gt;
srvalue                     84  95  99  790020&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 03:47:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335593#M99665</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2018-01-26T03:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I multiply 3 row values from 1 column and do it in one cell using append pipe.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335594#M99666</link>
      <description>&lt;P&gt;Tks that works for me.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 01:25:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335594#M99666</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2018-01-31T01:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I multiply 3 row values from 1 column and do it in one cell using append pipe.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335595#M99667</link>
      <description>&lt;P&gt;Tks that works for me.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 01:25:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-multiply-3-row-values-from-1-column-and-do-it-in-one/m-p/335595#M99667</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2018-01-31T01:25:29Z</dc:date>
    </item>
  </channel>
</rss>

