<?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 do I calculate USD based on Lookup table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38045#M8614</link>
    <description>&lt;P&gt;If you're not already, you'll probably want to utilize a temporal lookup for this as well.  That way, you can get the exchange rate at the time of the event, rather than always getting the current exchange rate.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jul 2011 17:39:15 GMT</pubDate>
    <dc:creator>mw</dc:creator>
    <dc:date>2011-07-05T17:39:15Z</dc:date>
    <item>
      <title>How do I calculate USD based on Lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38042#M8611</link>
      <description>&lt;P&gt;All our volume are recorded in multiple local currencies&lt;/P&gt;

&lt;P&gt;I need to create a report which show our volume in USD.&lt;/P&gt;

&lt;P&gt;I have created a look up table which contain the value: CUR EXCH&lt;/P&gt;

&lt;P&gt;I have created following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="summary" REPORT=PSVOL Type=Charge|LOOKUP PRJ_table PRJ OUTPUT PRG|lookup exch_rate CUR OUTPUT EXCH |eval Month= if(date_month="may", 5, if(date_month="june",6,if(date_month="january", 1, if(date_month="february",2, if(date_month="march",3, if(date_month="april",4, if(date_month="july",7, if(date_month="august",8,if(date_month="september",9,if(date_month="october",10, if(date_month="november",11, if(date_month="december",12,0))))))))))))|eval USDAMT=AMT*EXCH|  STATS SUM(AMT) SUM(USDAMT)  BY Month Type PRG CUR EXCH
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This give following result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Month   Type    PRG     CUR     EXCH    SUM(AMT)
1   Charge  XXX USD 1   555.6
1   Charge  YYY BRL 1.6022  666.6
1   Charge  ZZZ CAD 0.97675 777.7
1   Charge  VVV EUR 0.700648    888.8
1   Charge  TTT GBP 0.607312    999.9
2   Charge  XXX USD 1   111.1
2   Charge  YYY BRL 1.6022  222.1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Question: How do I calculate the value in USD?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2011 08:26:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38042#M8611</guid>
      <dc:creator>JYTTEJ</dc:creator>
      <dc:date>2011-07-05T08:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate USD based on Lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38043#M8612</link>
      <description>&lt;P&gt;Managed to solve the problem myself!:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="summary" REPORT=PSVOL Type=Charge|LOOKUP PRJ_table PRJ OUTPUT PRG|lookup exch_rate CUR OUTPUT EXCH |eval Month= if(date_month="may", 5, if(date_month="june",6,if(date_month="january", 1, if(date_month="february",2, if(date_month="march",3, if(date_month="april",4, if(date_month="july",7, if(date_month="august",8,if(date_month="september",9,if(date_month="october",10, if(date_month="november",11, if(date_month="december",12,0))))))))))))|stats sum(AMT) BY PRG CUR EXCH Month|rename sum(AMT) AS TOTAMT |EVAL USD=TOTAMT/EXCH | CHART SUM(USD) by Month PRG
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Jul 2011 13:02:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38043#M8612</guid>
      <dc:creator>JYTTEJ</dc:creator>
      <dc:date>2011-07-05T13:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate USD based on Lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38044#M8613</link>
      <description>&lt;P&gt;A little unrelated, but you might find this an easier to work with way of getting the numerical month number:&lt;/P&gt;

&lt;P&gt;eval month_number=strftime(_time,"%m")&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:42:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38044#M8613</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2020-09-28T09:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate USD based on Lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38045#M8614</link>
      <description>&lt;P&gt;If you're not already, you'll probably want to utilize a temporal lookup for this as well.  That way, you can get the exchange rate at the time of the event, rather than always getting the current exchange rate.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2011 17:39:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38045#M8614</guid>
      <dc:creator>mw</dc:creator>
      <dc:date>2011-07-05T17:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate USD based on Lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38046#M8615</link>
      <description>&lt;P&gt;Thanks! The strftime is really great!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2011 12:19:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-calculate-USD-based-on-Lookup-table/m-p/38046#M8615</guid>
      <dc:creator>JYTTEJ</dc:creator>
      <dc:date>2011-07-06T12:19:32Z</dc:date>
    </item>
  </channel>
</rss>

