+ Reply to Thread
Results 1 to 3 of 3

Power Query M language- Conditional Lookup/Merge

  1. #1
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Power Query M language- Conditional Lookup/Merge

    Hello,
    could you please help me write an M language expression equivalent of Excel formula:

    =IF(B1="CA",VLOOKUP(A1,'Cad Pricing'!$A$1:B3,2,FALSE),"VLOOKUP(A1,US Pricing'!$A$1:$B$3,2,FALSE)")

    to be used in the Power Query editor to add a column that looks up pricing in two queries Cad Pricing and US Pricing (connected to the the same file) depending on the value in another column
    Thank you!

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Power Query M language- Conditional Lookup/Merge

    Assumptions
    - the first table has columns Name and Amount and is called Table1
    - the table on 'CAD Pricing' is loaded into Power Query and that query is called CADPricing
    - the table on 'USD Pricing' is loaded into Power Query and that query is called USDPricing

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Re: Power Query M language- Conditional Lookup/Merge

    Thank you so much! I will give it a try.

+ 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. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  2. write SQLs in power query M language
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-14-2018, 10:56 AM
  3. [SOLVED] formula on power query (M language)
    By pccamara in forum Access Tables & Databases
    Replies: 3
    Last Post: 06-11-2018, 05:16 AM
  4. Power Query - merge by part of the string
    By zico8 in forum Excel General
    Replies: 1
    Last Post: 07-31-2017, 04:32 AM
  5. Merge Sheets Power Query
    By morerockin in forum Excel General
    Replies: 8
    Last Post: 04-11-2017, 08:17 AM
  6. Power Query, merge 2 or more large files in one
    By Remphan in forum Excel General
    Replies: 0
    Last Post: 03-02-2016, 04:28 AM
  7. Power Query, merge 2 or more large files in one
    By Remphan in forum Excel General
    Replies: 0
    Last Post: 03-02-2016, 03:30 AM

Tags for this Thread

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