+ Reply to Thread
Results 1 to 3 of 3

Add column that shows source table names in Power Query?

  1. #1
    Registered User
    Join Date
    01-16-2009
    Location
    Hartford, CT
    MS-Off Ver
    Excel 2010
    Posts
    56

    Add column that shows source table names in Power Query?

    I'm using Power Query to join three tables. In the results, I'd like there to be a column that shows the source table names.
    I know I could add an identifying column to each table before creating the query, but that solution isn't ideal. Is there a way to do it in PQ?
    Thanks!

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Add column that shows source table names in Power Query?

    I'm no expert on PQ but, given lack of response to your post thus far...

    Do you not have the option to Add a "Custom Column" in PQ Editor {via Add Column tab}?
    If so, add the Custom Column and set = Table Name, as a constant, e.g. ="Table X"; repeat for the other two tables / queries.

    edit: added working example... I did this using O365, but hopefully you will be able to see the definition in 2010 PQ {I don't know if the Editor is different}; in short - created three connections (one per table), each with a Custom Column added in PQ, and subsequently appended the 3 connections.
    Attached Files Attached Files
    Last edited by XLent; 02-13-2019 at 05:13 AM.

  3. #3
    Registered User
    Join Date
    01-16-2009
    Location
    Hartford, CT
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Add column that shows source table names in Power Query?

    Ahhh, I see what you did there. That is helpful and a bit more elegant than creating new columns directly in the spreadsheet itself. I was thinking, though, that there HAD to be a way to add only ONE additional column, within the query results, that somehow derived the source table name for each row and displayed that value. From what I'm finding, that is actually NOT the case. That surprises me. It seems like a common need, when dealing with multiple tables of data that get combined...users would want to know from which table the data was derived. Oh well...I appreciate this valuable tip, nonetheless. Thank you

+ 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. Power Query SQL (Source) run with manual table parameter?
    By Steveapa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2019, 09:03 PM
  2. Replies: 1
    Last Post: 11-12-2018, 02:46 PM
  3. Power Query: Using a Parameter to specify a source table name.
    By learning new things in forum Excel General
    Replies: 0
    Last Post: 11-06-2018, 04:21 PM
  4. Power Query shows as external data connection and can't refresh online
    By fuadramsey in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-26-2018, 06:04 PM
  5. Replies: 5
    Last Post: 06-29-2018, 05:35 AM
  6. Power Query Source vs Different PCs
    By flpneves in forum Excel General
    Replies: 1
    Last Post: 12-05-2017, 01:07 PM
  7. Power Query - add column with Table name
    By zico8 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 05-11-2017, 12:58 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