Hi there,
I’ve got stuck in preparation of this sales query. The primary sales table contains a mix of Canadian and the US detail invoice sales records. All sales records are in their native currencies The secondary lookup table contains daily US/CAN foreign exchange rates (FX). I need to multiply every $US sales record (marked with a “U”) with the FX rate in order to convert it to the Canadian currency. Unfortunately, this FX lookup table is missing over 50 daily rates in the last two years and as a result I cannot match them date-by-date with the sales table.
As a workaround, it is acceptable to use the previous FX rate in the table. The previous rate can be one or more days before the transaction occurred.
I don’t know how to point to that previous FX record, therefore any help is appreciated.
Attached is a sample database with the query that I’ve already built.
The query contains two sample US records that are missing the FX rate on Jan 6. The FX rate of $1.0639 that needs to be applied to it should come from Jan 3rd entry.
New Date sales matcode curtype trans newrate
1/3/2014 1225.6128 1173224 U R18761 1.0639
1/3/2014 344.7036 1173260 U R18173 1.0639
1/6/2014 2520 0022691 U R19841
1/6/2014 5400 0022692 U R19841
Thank you.
I’ve got stuck in preparation of this sales query. The primary sales table contains a mix of Canadian and the US detail invoice sales records. All sales records are in their native currencies The secondary lookup table contains daily US/CAN foreign exchange rates (FX). I need to multiply every $US sales record (marked with a “U”) with the FX rate in order to convert it to the Canadian currency. Unfortunately, this FX lookup table is missing over 50 daily rates in the last two years and as a result I cannot match them date-by-date with the sales table.
As a workaround, it is acceptable to use the previous FX rate in the table. The previous rate can be one or more days before the transaction occurred.
I don’t know how to point to that previous FX record, therefore any help is appreciated.
Attached is a sample database with the query that I’ve already built.
The query contains two sample US records that are missing the FX rate on Jan 6. The FX rate of $1.0639 that needs to be applied to it should come from Jan 3rd entry.
New Date sales matcode curtype trans newrate
1/3/2014 1225.6128 1173224 U R18761 1.0639
1/3/2014 344.7036 1173260 U R18173 1.0639
1/6/2014 2520 0022691 U R19841
1/6/2014 5400 0022692 U R19841
Thank you.