Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (11.1k points)

I am having a Sales transaction table with RateDate,OrderAmount and Transcation Currency

enter image description here

and also I am having exchange rate with BaseCurrency,targetCurrency and Rate

enter image description here

I need to convert Sales amount to Base Currency and I have tried the following DAX equation

AmountUSD = SUMX(Fact_SalesOrder,[OrderAmount]/lookupvalue(CurrencyRates[Rate],CurrencyRates[Effective Date],Fact_SalesOrder[RateDate],CurrencyRates[Base Currency],"USD",CurrencyRates[Target Currency],Fact_SalesOrder[Currency]))

But I am not getting a proper result How can I solve this? 

1 Answer

0 votes
by (22.5k points)

Use the following two measures

Selected Currency = VALUES('ReportingCurrencies'[Currency])

 And

SalesAmount = SWITCH(TRUE(),
[Selected Currency] = "EUR",SUMX(Fact_SalesOrder,[OrderAmount]/lookupvalue(CurrencyRates[Rate],CurrencyRates[Effective Date].[Date],Fact_SalesOrder[RateDate].[Date],CurrencyRates[Base Currency],"EUR",CurrencyRates[Target Currency],Fact_SalesOrder[Currency],1)),
[Selected Currency] = "USD",SUMX(Fact_SalesOrder,[OrderAmount]/lookupvalue(CurrencyRates[Rate],CurrencyRates[Effective Date].[Date],Fact_SalesOrder[RateDate].[Date],CurrencyRates[Base Currency],"USD",CurrencyRates[Target Currency],Fact_SalesOrder[Currency],1)),
[Selected Currency]

Want to learn more about Power BI? Check out today: Power BI course    

Related questions

0 votes
1 answer
asked Jan 17, 2021 in BI by Chris (11.1k points)
0 votes
1 answer
0 votes
1 answer
asked Sep 15, 2021 in BI by dev_sk2311 (45k points)
0 votes
1 answer
asked Aug 25, 2021 in BI by dev_sk2311 (45k points)

Browse Categories

...