Forum Discussion
FaizanRao
5 years agoNew Member
Exchange rate conversion with date range
Hi I need help to calculate sales in USD and Peso based on the exchange rate in Table 2. Thanks Faizan Rao
- 5 years ago
selimovd
5 years agoMost Valuable Professional
Hey FaizanRao ,
as calculated column something like this should do it:
Sales in USD =
VAR vInvoiceDateCurrentRow = 'Table 1'[Invoice Date]
VAR vCurrencyCurrentRow = 'Table 1'[Sales Currency]
VAR vExchangeRate =
CALCULATE(
MAX( 'Table 2'[Exchange Rate] ),
'Table 2'[Currency From] = vCurrencyCurrentRow
&& 'Table 2'[Currency To] = "USD"
&& 'Table 2'[Date From] <= vInvoiceDateCurrentRow
&& 'Table 2'[Date To] >= vInvoiceDateCurrentRow
)
RETURN
'Table 1'[Sales Value] * vExchangeRate
If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
Best regards
Denis
Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic
- FaizanRao5 years agoNew Member
Hi Denis
Thanks for your prompt reply but still need your help to fix the following error.