Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
abfdjuk
Helper I
Helper I

currency conversion with budgeted rates

Hi.

 

I have two tables of data. One is the currency, year and exchange rate "ExchangeRates" the other is "Invoices" with colums for year, net amount and currency code. I have tried so many different formulas - all the ones I would use in excel don't seem to work! and keep hitting errors. The latest one I get is: a single value cannot be determined...

 

My question is how do I create a calculation which does does a currency conversion using the exchange rate in a set year from the "exchangeRates" table and then calculates this against the invoice amount?

 

many thanks for any help

 

abfdjuk_1-1667316395553.png

abfdjuk_2-1667316508298.png

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Converted amount =
SUMX (
    Invoices,
    Invoices[Net amount]
        * LOOKUPVALUE (
            ExchRate[Rate],
            ExchRate[Currency code], Invoices[Currency code],
            ExchRate[Year], Invoices[Year]
        )
)

View solution in original post

7 REPLIES 7
johnt75
Super User
Super User

Converted amount =
SUMX (
    Invoices,
    Invoices[Net amount]
        * LOOKUPVALUE (
            ExchRate[Rate],
            ExchRate[Currency code], Invoices[Currency code],
            ExchRate[Year], Invoices[Year]
        )
)

I just tried this and get the following error: Function 'LOOKUPVALUE' does not support comparing values of type Integer with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

 

yes, because YearCode in your table is of type "String" (text in PowerQuery) -> change it to integer (number in powerquery)

nks for your quick response. Now I get this error: A table of multiple values was supplied where a single value was expected. Any ideas what I need to change?

it looks like you have multiple entries for the same combination of year and currency code. 

Thanks for your help.

lukiz84
Memorable Member
Memorable Member

ConvertedSum = 
   VAR InvoiceDate = SELECTEDVALUE(Invoices[InvoiceDate])
   VAR Currency = SELECTEDVALUE(Invoices[Curreny])
   VAR ConversionRate = 
      CALCULATE(
         MIN(ConversionRates[rate]),
         ConversionRates[currency] = Currency, 
         ConversionRates[cear] = YEAR(InvoiceDate)
      )

   RETURN SUM(Invoices[Invoices - Net amount]) * ConversionRate
   

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.