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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Get Exchange Rate By Merging Tables Based on the Closest Date

Dear All,

 

I'm new to PowerQuery and I need your help. As you can see, I have a table with my Orders (named: OrdersSA18_PowerBI) and another with my Exchange Rates (named: Exchange Rate Table) I would like to add a column to my orders table where I would have my exchange rate for each row. However, I don't have an exchange rate for each day, and I would like to otain a column in my Orders Table where the exchange rate would be the closest in terms of Date. Which means : [Order Date] <= [Starting Date]

Capture d’écran 2022-03-09 100710.png

Capture d’écran 2022-03-09 100931.png

 

Thank you in advance for your help 😁

 

1 ACCEPTED SOLUTION

In that case you can create a Index Column in both the tables and then merge those two tables.
1)Create Index Column in both tables by going to Add column->Index Column.
2)Perform Merge operation and select Index Columns from both tables.


Let me know if it works.

Thanks,
Sanket


If this post helps, then mark it as 'Accept as Solution' and give it a thumbs up.

View solution in original post

4 REPLIES 4
SanketBhagwat
Solution Sage
Solution Sage

Hi @Anonymous .

For Append to work, you need to have one common column in both the tables.
One solution can be using DAX.

If both of those tables are related then you can use NewColumn=RELATED(Exchange Rate Amount)
If they both are not related then you can use LOOKUPVALUE.

See dcoument below;
https://docs.microsoft.com/en-us/dax/related-function-dax
https://docs.microsoft.com/en-us/dax/lookupvalue-function-dax


Thanks,
Sanket.

If this post helps, then mark it as 'Accept as Solution' and give it a thumbs up.



Anonymous
Not applicable

Yes, I had already achieved this solution using Dax, but I need this to be done in PowerQuery if it is possible of course. Thank you anyway for your fast answer.

In that case you can create a Index Column in both the tables and then merge those two tables.
1)Create Index Column in both tables by going to Add column->Index Column.
2)Perform Merge operation and select Index Columns from both tables.


Let me know if it works.

Thanks,
Sanket


If this post helps, then mark it as 'Accept as Solution' and give it a thumbs up.

Anonymous
Not applicable

It works. Thank your for your help 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors