+ Reply to Thread
Results 1 to 7 of 7

Power Query merge with lookup table

  1. #1
    Registered User
    Join Date
    08-14-2012
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    35

    Power Query merge with lookup table

    Hi,
    My (mini) project has 2 parts. The first part, I have already solved. The second part I am stuck on.

    Solved first part
    I have a transaction table of many stock & option trades. I need to group the transactions by trade group & ticker along with few other columns. I did that using power query and the output is in "XClosed Output" sheet in the way I want.

    Second part - Unsolved
    The transactions are either in USD or CAD, with an open & closed date. I have an exchange rate lookup table. For the USD transactions, I want to multiply the prices with the exch rate and convert them. I have created a sample output with basic excel formula.

    But i am looking for some sort of merge table functionality that will give me the output. Should I explore if something in Dax can make it possible?
    Attached Files Attached Files
    Last edited by amitdi; 03-07-2023 at 10:18 PM. Reason: solved

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query merge with lookup table

    try to merge twice XClosedTable with ExchTable by appropriate date then if [Currency] = CAD then multiply [Amt O] * [FXUSDCAD] else if if [Currency] = USD then multiply [Amt C] * [FXUSDCAD.1]
    Last edited by sandy666; 03-07-2023 at 09:53 PM.

  3. #3
    Registered User
    Join Date
    08-14-2012
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    35

    Re: Power Query merge with lookup table

    Quote Originally Posted by sandy666 View Post
    try to merge twice XClosedTable with ExchTable by appropriate date then if [Currency] = CAD then multiply [Amt O] * [FXUSDCAD] else if if [Currency] = USD then multiply [Amt C] * [FXUSDCAD.1]
    yes, that would be for the open date, but what about closed date ("Date C" column).

    Edit: never mind, figured it out. I can then merge again to add a 2nd column for closed exchange rate. once I have the two exchange rate, rest is easy to add.
    Last edited by amitdi; 03-07-2023 at 09:58 PM.

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query merge with lookup table

    appropriate date means first merge by [Date O], second by [Date C]

    use Inner option, will be less records

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query merge with lookup table

    so...



    if the problem is solved, make me happy and hit Add Reputation (bottom left corner next to the post that was helpful)

  6. #6
    Registered User
    Join Date
    08-14-2012
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    35

    Re: Power Query merge with lookup table

    Quote Originally Posted by sandy666 View Post
    so...



    if the problem is solved, make me happy and hit Add Reputation (bottom left corner next to the post that was helpful)
    of course, added now..thanks !!!

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query merge with lookup table

    You are welcome

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Merge Table with Power Query. Primary Key with Duplicate values
    By fkarim74 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-03-2022, 02:52 PM
  2. Replies: 18
    Last Post: 10-24-2022, 09:13 PM
  3. [SOLVED] merge table into power query and keep greater date
    By Undo in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 09-18-2021, 09:36 AM
  4. [SOLVED] Merge Pro tip in Power Query
    By hudson andrew in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2021, 03:53 AM
  5. [SOLVED] Lookup in same Power Query table
    By Imbizile in forum Excel General
    Replies: 2
    Last Post: 11-11-2020, 04:32 AM
  6. Power Query M language- Conditional Lookup/Merge
    By Ballet4ever in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-30-2019, 04:39 PM
  7. Replies: 9
    Last Post: 11-29-2017, 01:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1