+ Reply to Thread
Results 1 to 3 of 3

Power Query: Appending empty data set

  1. #1
    Registered User
    Join Date
    03-08-2019
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    57

    Exclamation Power Query: Appending empty data set

    Hi,

    I am struggling with a Power Query element in Excel 2013.

    Basically, I am trying to import a set of data (let's call it data set 1) from another Excel file, clean it up by replacing a space and a dash in the ID column (formatted as "010180-1210"), change the column names from "id" and "name" to "ID" and "Name", and change the number formatting of "ID" column, before before appending it into another query (from another data set, say data set 2).

    The structure, column names (except for "ID" and "Name") and formatting of the two sets of data are completely different, but the issue is that while data set 2 will always contain data, data set 1 might not always do.

    In the cases where data set 1 does not contain data, the query succeeds with removing columns because of the "MissingField.Ignore" argument, but fails in replacing values and changing number formatting.

    So, I am looking for a similar argument (or other solution) that allows me to basically append nothing if data set 1 is empty, but ensures that the query does not fail (since the appended query fails in that event too).

    I have included the M code below (I know it could be a lot cleaner but bear with me). Thanks in advance.


    Please Login or Register  to view this content.
    Last edited by Phil123456789; 02-02-2020 at 05:28 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,715

    Re: Power Query: Appending empty data set

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-08-2019
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    57

    Re: Power Query: Appending empty data set

    My apologies. Please see the edited post above - thanks.

+ 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. 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
  2. [SOLVED] Power Pivot does not load new column added in Power query
    By ibuhary in forum Excel General
    Replies: 12
    Last Post: 02-19-2019, 03:53 AM
  3. Appending Charts using Power Query Excel 2016
    By STokhi1 in forum Excel Charting & Pivots
    Replies: 13
    Last Post: 07-02-2018, 07:30 AM
  4. 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
  5. Replies: 0
    Last Post: 04-05-2018, 01:16 AM
  6. Appending Power Query in VBA
    By randallrosa in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-05-2017, 03:48 AM
  7. Replies: 2
    Last Post: 11-17-2010, 06:59 PM

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