+ Reply to Thread
Results 1 to 3 of 3

Power Query - Merge based on Bands

  1. #1
    Forum Contributor
    Join Date
    07-10-2020
    Location
    New Zealand
    MS-Off Ver
    365 personal
    Posts
    324

    Power Query - Merge based on Bands

    Hi

    I have a master table that sets out bands and a regional code for each band. The Master also has specific mappings for specific codes.

    Where there is not an exact match I wish to merge based on a band. Where there is an exact match I wish to use the specific mapping contained in the Master table.

    My scenario is set out in the attached file.

    I am open to ideas as to how to do this - A conditional column seems laborious - are there other options?

    Thank You

    Allister
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Power Query - Merge based on Bands

    Please try

    PHP Code: 
    let
        Source 
    Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        
    AReg Table.AddColumn(Source"Region"each  try Table2{[Code=[Code]]}[Regionotherwise 
            
    List.First(Table.SelectRows(Table2,(T)=> T[Code]<=[Code] and T[Code]> Number.ToText(Number.From([Code])-0.1,"0.000" ))[Region]) ?? "no mapping" )
    in
        AReg 
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    07-10-2020
    Location
    New Zealand
    MS-Off Ver
    365 personal
    Posts
    324

    Re: Power Query - Merge based on Bands

    Nice solution Bo_Ry

+ 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. [SOLVED] Merge data in power query
    By Undo in forum Excel General
    Replies: 4
    Last Post: 08-19-2021, 05:42 AM
  2. [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
  3. Power Query Merge only the First Instance
    By c4revolution in forum Excel General
    Replies: 1
    Last Post: 04-13-2021, 04:35 AM
  4. new entry in merge power query
    By rosscortb in forum Excel General
    Replies: 1
    Last Post: 04-24-2020, 05:02 AM
  5. Power query merge column
    By Eric Tsang in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-17-2020, 09:08 AM
  6. [SOLVED] Get and Transform (Power Query) - Grouping numbers into bands/buckets
    By TheNewUnion in forum Excel General
    Replies: 2
    Last Post: 03-12-2019, 05:37 AM
  7. Merge Sheets Power Query
    By morerockin in forum Excel General
    Replies: 8
    Last Post: 04-11-2017, 08:17 AM

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