Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Trebor84
Helper II
Helper II

Append empty table

Hi,

 

I have an issue when trying to append two tables in Power Query.

 

I have two tables that are both linked to SharePoint folders and both queries pull in all files from each sub directory.

On a daily basis we have ongoing work files (table1) and completed work (table2).

 

Before I import any new queries each day, I get a unique list of job ID’s by appending both of these tables then remove duplicate ID’s,


The problem I have is that there isn’t always ongoing work files in the folder so if the folder is empty then it breaks the query due to the table being empty and I receive the below error.

 

An error occurred in the ‘Sample File (3)’ query. Expression.Error: There weren't enough elements in the enumeration to complete the operation.

 

This then prevents me appending table 1 to table 2.

 

Is there any way I can prevent this from happening so if table 1 is empty then it doesn’t do the append step? I have read that a try...otherwise statement might help?

 

The problem is that as the table returns the above error I can’t even see it when I bring up the append window as Power Query doesn’t list the table (table1).


I’m not trying to create a new table, just trying to append table1 data into table2.

 

Any suggestions please?

2 REPLIES 2
jennratten
Super User
Super User

Hello - this is a common problem.  I handle this by including a sample data table (not loaded) that has all of the elements that would be required to make the queries execute successfully, but contains a keyphrase or value which is specifically used to remove the sample rows after processing is complete.  Based on the task at hand, it sometimes makes sense to append the sample data table right from the start and then filter it out at the end.  In other scenarios, it may make sense to conditionally append the tables based on whether or not the actual table has rows, or simply use one or the other using try/otherwise.  The construct of my sample data table is the same regardless of which scenario is encountered and I usually create the sample data table by copying some of the rows from a real table and pasting it into a new table, then changing the values.

I hope this info helps!  Please let me know if you have any questions.

NikhilChenna
Continued Contributor
Continued Contributor

Hi @Trebor84 ,

You cannot keep the table empty , it will not work and give you error. 

 

Regards,

Nikhil Chenna

 

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors