+ Reply to Thread
Results 1 to 10 of 10

Power Query: Merge Query using Reference Query

  1. #1
    Registered User
    Join Date
    02-02-2024
    Location
    Glasgow, Scotland
    MS-Off Ver
    365
    Posts
    36

    Power Query: Merge Query using Reference Query

    Hi

    In theory, is it possible to Merge Query against a Reference query back to the original data?

    I have a data file, then creating a Reference Query (not Duplicating) using the data file, and then Grouping the data using the Reference. This is simply to total values on invoice numbers. This is then being merged back to the main data on each line. If the invoice has multiple lines then the same value is entered on each line.

    So the issue is, when trying to merge, the 2nd query file (the Reference Group) is showing blank, and I can't continue. The Reference Query shows in the dropdown option, then the fields just don't show.

    If I duplicate the data it works perfectly, but want to use Reference if possible to speed up refreshes.

    Does Power Query dislike merging back to itself is using Reference?

    I am using live business information so unable to post the file, so just asking if it should be doable, in theory. (If it is then I'll sort sample data and post)

    thanks
    Barry

  2. #2
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Power Query: Merge Query using Reference Query

    I do it frequently.
    You could try to use a index column..

  3. #3
    Registered User
    Join Date
    02-02-2024
    Location
    Glasgow, Scotland
    MS-Off Ver
    365
    Posts
    36

    Re: Power Query: Merge Query using Reference Query

    Perhaps being thick, but how does an index column help?

    Have attached a screenshot of what's happening.
    Stg_Invoice303_RS is my main data. I've Referenced this into the query named Reference.
    On Reference I have Grouped by Invoice number, with a Sum value.
    In Stg_Invoice303_RS I am using Merge Query, and on the window that pops up, where I am selecting Reference, the field window shows No Preview Available. So I can't continue.

    If I use Duplicate instead of Reference it works...
    Attached Images Attached Images

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Power Query: Merge Query using Reference Query

    It seems to me that you are essentially creating a circular reference. Your Reference query is a reference to the final result of the first query, which would depend on the merge you are doing.
    Rory

  5. #5
    Registered User
    Join Date
    02-02-2024
    Location
    Glasgow, Scotland
    MS-Off Ver
    365
    Posts
    36

    Re: Power Query: Merge Query using Reference Query

    Quote Originally Posted by rorya View Post
    It seems to me that you are essentially creating a circular reference. Your Reference query is a reference to the final result of the first query, which would depend on the merge you are doing.
    Yeah, I did wonder if that would be the issue, given it works fine when Duplicated. Oh well, at least I know.

    Cheers

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Power Query: Merge Query using Reference Query

    You'd need two reference queries, so you can merge those two as they don't depend on each other.

  7. #7
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Power Query: Merge Query using Reference Query

    In this file I did a self-reference in lines 'ToBeAppendedQuery' and 'ToAppend'.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-02-2024
    Location
    Glasgow, Scotland
    MS-Off Ver
    365
    Posts
    36

    Re: Power Query: Merge Query using Reference Query

    Quote Originally Posted by rorya View Post
    You'd need two reference queries, so you can merge those two as they don't depend on each other.
    Ah good shout. This works. Thank you!

  9. #9
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Power Query: Merge Query using Reference Query

    Quote Originally Posted by DJunqueira View Post
    In this file I did a self-reference in lines 'ToBeAppendedQuery' and 'ToAppend'.
    Slightly different situation. You basically did the two reference queries but as steps in one main query.

  10. #10
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Power Query: Merge Query using Reference Query

    Well, if you do not see an example in which a solution can be applied, misinterpretations may occur.

+ 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. Replies: 3
    Last Post: 03-01-2024, 03:59 AM
  2. [SOLVED] Power Query: Add a new query to an existing Query that already has multiple queries
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-06-2023, 04:33 PM
  3. [SOLVED] [Power Query] How to filter 0 from two columns in power query editor in one step?
    By daliye in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2023, 09:44 PM
  4. Replies: 1
    Last Post: 07-14-2023, 10:15 AM
  5. [SOLVED] Power query table reference to another query
    By Undo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-26-2021, 09:41 AM
  6. Replies: 4
    Last Post: 02-17-2020, 06:03 AM
  7. Excel Power Query Refresh or Access Query - 2nd Query Run is faster
    By Steveapa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2020, 10:16 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