Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi Team,
I have two tables, Sales and Currency. See below:
I would like to populate Sales.Exchange Rate GBP and Sales.Exchange Rate USD with the exchange rates from the currency table (values above are my expected results)
The logic I need to use looks something like this (For GBP):
select earliest exchange rate from Currency where Sales.Currency = Currency.Source and Currency.Target = 'GBP' and Sales.Date > Currency.Date
How can I accomplish this?
Solved! Go to Solution.
https://www.dropbox.com/s/o04lz90nbzttotv/reporting%20model.pbix?dl=0
Exchange rate GBP CC=
VAR sourcecurrency = Requests[Currency]
VAR targetcurrency = "GBP"
VAR currentdate = Requests[Date Requested]
VAR maxcurrencydate =
CALCULATE (
MAX ( 'Currency'[date] ),
FILTER (
'Currency',
'Currency'[date] <= currentdate
&& 'Currency'[sourcecurrency] = sourcecurrency
&& 'Currency'[targetcurrency] = targetcurrency
)
)
RETURN
CALCULATE (
CALCULATE ( SUM ( 'Currency'[exchangerate] ) ),
FILTER (
'Currency',
'Currency'[date] = maxcurrencydate
&& 'Currency'[sourcecurrency] = sourcecurrency
&& 'Currency'[targetcurrency] = targetcurrency
)
)
Thank you @Jihwan_Kim ,
I appreciate the time you spent doing this, I will try and make it work
I see you have created a SourceCurrency table, is this a necessary step in addition to my current currency table? My source currencies have more than just AUD so ideally I would rather not have to create this
J
You are right.
If you do not have other currencies, it is not mandatorily needed.
Hi @Jihwan_Kim
I have tried to implement your solution but it is not working, I have attached a link to a PowerBI model. As you can see I am trying to add a new column to my table 'Requests' but it is returning no results
https://www.dropbox.com/s/o04lz90nbzttotv/reporting%20model.pbix?dl=0
Exchange rate GBP CC=
VAR sourcecurrency = Requests[Currency]
VAR targetcurrency = "GBP"
VAR currentdate = Requests[Date Requested]
VAR maxcurrencydate =
CALCULATE (
MAX ( 'Currency'[date] ),
FILTER (
'Currency',
'Currency'[date] <= currentdate
&& 'Currency'[sourcecurrency] = sourcecurrency
&& 'Currency'[targetcurrency] = targetcurrency
)
)
RETURN
CALCULATE (
CALCULATE ( SUM ( 'Currency'[exchangerate] ) ),
FILTER (
'Currency',
'Currency'[date] = maxcurrencydate
&& 'Currency'[sourcecurrency] = sourcecurrency
&& 'Currency'[targetcurrency] = targetcurrency
)
)
Hi @Jihwan_Kim ,
Thank you, it works.
I had to add a DATEVALUE function to my currentdate variable as it was complaining about comparing date and strings.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.