Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I have a queue folder with many subfolders for different queue data that I download Excel files every day. Each subfolder has a query made for it, and my end result is an append of all the final tables from those queries.
My issue is some days there just isn't any queue files that gets downloaded for some of the subfolders-they are empty. So I get the error:
Expression.Error: There wasn't enough elements in the enumeration to complete the operation.
Details:
[Table]
This error shows up in the Sample File of whatever folder is empty that day.
Here's my original code:
let
Source= Folder.Files ("S:\My Folder\Queue\Subfolders"),
Navigation1 = Source {0}[Content]
in
Navigation1
This error is happening in the Sample File for any query that the folder is empty. If there's no files there I'd like the query to either skip that empty folder or make an empty 'place holder table'
I have the feeling I should use the try..otherwise expression but where- the Sample File or in each of the tables since they also have a Source code line??
Use this one
let
Source= Folder.Files ("S:\My Folder\Queue\Subfolders"),
Navigation1 = try Source {0}[Content] otherwise null
in
Navigation1
You cannot append null to a table. Needs to be an empty table.
Table:
= #table({"Column1","Column2"},{{"Q","A"}})
Table2:
= #table({"Column1","Column2"},{})
Source{0}?[Content]? // gives you null
let
Source= Folder.Files ("S:\My Folder\Queue\Subfolders"),
Navigation1 = if Table.CountRows(Source)>0 then Source{0}[Content] else <fake empty table with a [Content] column that you prepared before>
in
Navigation1
This sort of worked but now my Transform Parameter is bugging out because dummies me said they were Excel files and they are CSV files.
Please provide sample data that fully covers your issue.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 |