<?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: Calculate w different prices based on cliplevels in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73305#M181074</link>
    <description>&lt;P&gt;This works fine! - but I also want to display on the same report how the total has been calculated. I.e. a report showing:&lt;/P&gt;

&lt;P&gt;CUSTOMER Trx   Trx_Charge Amount&lt;BR /&gt;
XXX      10000 3.33       33300,00&lt;BR /&gt;
XXX      10000 2.33       22200,00&lt;BR /&gt;
XXX       1111 1.11        1234,00&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Do you have more good ideas?&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Fri, 12 Jul 2013 11:07:03 GMT</pubDate>
    <dc:creator>JYTTEJ</dc:creator>
    <dc:date>2013-07-12T11:07:03Z</dc:date>
    <item>
      <title>Calculate w different prices based on cliplevels</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73302#M181071</link>
      <description>&lt;P&gt;Hi, I need to make a report which need to calculate with two different prices.&lt;/P&gt;

&lt;P&gt;Price 3,33 USD for the first 10000 trx within a month&lt;/P&gt;

&lt;P&gt;Price 2,22 for  10001 - 20001 trx within same month&lt;/P&gt;

&lt;P&gt;Price 1,11 for 20001 + trx within the same month&lt;/P&gt;

&lt;P&gt;I have tried following:&lt;/P&gt;

&lt;P&gt;|accum Trx as Accum_trx |EVAL Charge=if(Accum_trx &amp;lt;10000,3.33, if(Accum_trx&amp;gt;10001 AND Accum_trx&amp;lt;20001,2.22, 1.11))&lt;/P&gt;

&lt;P&gt;If Accum_trx are &lt;/P&gt;

&lt;P&gt;3444&lt;/P&gt;

&lt;P&gt;7000&lt;/P&gt;

&lt;P&gt;9500&lt;/P&gt;

&lt;P&gt;10500&lt;/P&gt;

&lt;P&gt;the search will calculate 9500*3.33&lt;/P&gt;

&lt;P&gt;and 10500 minus 9500 = 1000*2.22&lt;/P&gt;

&lt;P&gt;I need to calculate 500 * 3.33 and 500 * 2.22 instead.&lt;/P&gt;

&lt;P&gt;How do I accomplish this?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73302#M181071</guid>
      <dc:creator>JYTTEJ</dc:creator>
      <dc:date>2020-09-28T14:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate w different prices based on cliplevels</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73303#M181072</link>
      <description>&lt;P&gt;Two things I'd suggest:&lt;BR /&gt;
1) use the case function instead of nested "ifs"&lt;BR /&gt;
2) use the "delta" command to calculate the difference between the accum_trx of the previous event and your current event&lt;/P&gt;

&lt;P&gt;With these two changes you should be able to get what you need.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2013 17:09:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73303#M181072</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2013-06-24T17:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate w different prices based on cliplevels</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73304#M181073</link>
      <description>&lt;P&gt;Why not:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| stats count as numTransactions by customer
| eval charge = case(numTransactions &amp;lt; 10001,numTransactions *3.33,
                     numTransactions &amp;lt; 20001,33300+(numTransactions-10000)*2.22,
                     numTransactions &amp;gt; 20000,55500+(numTransactions-20000)*1.11)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jun 2013 20:40:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73304#M181073</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-06-24T20:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate w different prices based on cliplevels</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73305#M181074</link>
      <description>&lt;P&gt;This works fine! - but I also want to display on the same report how the total has been calculated. I.e. a report showing:&lt;/P&gt;

&lt;P&gt;CUSTOMER Trx   Trx_Charge Amount&lt;BR /&gt;
XXX      10000 3.33       33300,00&lt;BR /&gt;
XXX      10000 2.33       22200,00&lt;BR /&gt;
XXX       1111 1.11        1234,00&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Do you have more good ideas?&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Fri, 12 Jul 2013 11:07:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73305#M181074</guid>
      <dc:creator>JYTTEJ</dc:creator>
      <dc:date>2013-07-12T11:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate w different prices based on cliplevels</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73306#M181075</link>
      <description>&lt;P&gt;Second answer, based on the request to show how the charges were calculated&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| stats count as totalTransactions by customer
| eval charge = case(totalTransactions &amp;lt; 10001,totalTransactions *3.33,
                     totalTransactions &amp;lt; 20001,33300+(totalTransactions-10000)*2.22,
                     totalTransactions &amp;gt; 20000,55500+(totalTransactions-20000)*1.11)
| eval Transactions = case(totalTransactions &amp;lt; 10001,tostring(totalTransactions),
                     totalTransactions &amp;lt; 20001,"10000\n"+tostring(totalTransactions-10000)),
                     totalTransactions &amp;gt; 20000,"10000\n10000\n"+tostring(totalTransactions-20000))
| eval Rates = case(totalTransactions &amp;lt; 10001,"3.33",
                     totalTransactions &amp;lt; 20001,"3.33\n2.22",
                     totalTransactions &amp;gt; 20000,"3.33\n2.22\n1.11")
| table customer totalTransactions charge Transactions Rates
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This seemed simplest, but there are other ways&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2013 16:01:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-w-different-prices-based-on-cliplevels/m-p/73306#M181075</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-07-15T16:01:27Z</dc:date>
    </item>
  </channel>
</rss>

