Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi there,
I keep getting this refresh error on Power BI service - Expression.Error: There weren't enough elements in the enumeration to complete the operation.. #table({"Content", "Name", "Extension", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}, {}). ;There weren't enough elements in the enumeration to complete the operation.. The exception was raised by the IDbCommand interface. Table: 22/23 Salaries. The table the error refers to often changes.
When I go into desktop and refresh, everything is working fine. None of the tables are blank. All of the data I am using is from the same sharepoint folder. I've tried clearing cache and checking the connection. I've even removed the tables and added them back in. I've never had issues with this dashboard before but recently added in a few extra tables/queries, but from the same data source and following the same steps. I can't wrap my head around why the refresh is failing if it's fine in desktop.
Any thoughts?
Thanks!
Thankyou, @BhavinVyas3003, @Nasif_Azam, for your response.
Hi lnedeah,
We sincerely appreciate your inquiry posted on the Microsoft Fabric Community Forum.
Based on my understanding, the primary cause of the error message, “Expression.Error: There weren’t enough elements in the enumeration…”, arises due to the difference in how Power BI Service processes folder queries compared to Power BI Desktop. Specifically, Power BI Service attempts to process one or more files that return incomplete or empty data structures. This issue may not be evident during refresh in Power BI Desktop because of local caching and differing credential contexts.
The issue tends to occur only in the Service environment due to the following reasons:
Kindly follow the steps below which may help in resolving the issue:
Additionally, please refer to the following links for further guidance:
Power Query SharePoint folder connector - Power Query | Microsoft Learn
Data refresh in Power BI - Power BI | Microsoft Learn
Error handling - Power Query | Microsoft Learn
If you find our response helpful, kindly mark it as the accepted solution and provide kudos. This will assist other community members encountering similar issues.
Should you have any further queries, please do not hesitate to contact the Microsoft Fabric community.
Thank you.
Hey @lnedeah ,
This error typically occurs when Power BI tries to construct a table with a defined schema (column headers), but the data (rows) doesn't match specifically, it's expecting 8 fields per row and is getting fewer (or none).
Power BI is using a SharePoint Folder connector where schema detection might fail if the sample file is missing or unreadable.
The folder may contain empty or invalid files that don't provide all the expected fields.
A query may have a hardcoded table structure that doesn’t match the actual data during refresh.
Power BI Desktop uses your local credentials, while the Service uses stored credentials that might lack access.
Try 5 Fixes:
1. Review Your SharePoint Folder Query
Go to the query that uses SharePoint Folder, and look for a step like:
= #table({"Content", "Name", "Extension", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}, {})
Make sure it's not trying to create a table with no data. If you see {} there, it's trying to construct a table with no rows.
2. Check Data Source Credentials in Power BI Service
Go to Power BI Service → Settings → Datasets → your dataset → Data source credentials.
Make sure you're using OAuth 2.0 and the connection is valid.
Re-authenticate the SharePoint Folder connection if needed.
3. Validate Files in the Folder
Make sure all files in the SharePoint folder you’re referencing:
Match the expected schema
Are not empty
Are not in a temporary or unsupported format
Also, avoid mixing file types (.xlsx, .csv, .tmp) if you're filtering by extension later in the query.
4. Add Defensive Logic in Power Query
Modify the query that uses #table or the folder to only proceed if files are found:
let Source = SharePoint.Files("https://yourtenant.sharepoint.com/sites/yourSite", [ApiVersion = 15]), FilteredFiles = Table.SelectRows(Source, each [Extension] = ".xlsx"), CheckIfEmpty = if Table.IsEmpty(FilteredFiles) then error "No files found" else FilteredFiles in CheckIfEmpty
This avoids passing an empty table into downstream steps, which may trigger that enumeration error.
5. Refresh from Power BI Desktop and Re-Publish
If you've fixed anything in Power Query:
Refresh in Power BI Desktop to confirm it works.
Save and Publish again to Power BI Service.
Schedule a refresh or trigger it manually.
For Detailed Information:
Troubleshoot Power BI Data Refresh
Connect to SharePoint folder in Power BI
Configure scheduled refresh - Power BI
Power Query M error messages
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam
Hi, thanks. Yeah I've seen this explanation before but the table isn't empy, and I'm not getting this error in desktop. Do you have any idea why this error would only show in service? Thanks
Hey @BhavinVyas3003 ,
You're absolutely right to wonder why something that works fine in Desktop fails in the Power BI Service. That difference is often the key to solving issues like this.
Why It Fails in Power BI Service but Not in Desktop?
When you refresh in Power BI Desktop, the queries run in your local environment using your own permissions and network. But in the Power BI Service, the dataset is refreshed in Microsoft's cloud environment using saved credentials which may behave differently, especially for file access or authentication. Even though the table isn't empty in Desktop, here are a few reasons why the Service might still throw error.
Common Service-Only Issues
What You Can Do Next
For Detailed Information:
Troubleshoot Power BI Data Refresh
Connect to SharePoint folder in Power BI
Configure scheduled refresh - Power BI
Power Query M error messages
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam
The error indicates that one of your folder queries (e.g., from SharePoint) returned an unexpected or empty structure during refresh in Power BI Service, likely due to a missing or unreadable file, a promoted header step being applied to an empty table, or the presence of unsupported or hidden files in the folder.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
50 | |
31 | |
26 | |
26 | |
25 |
User | Count |
---|---|
61 | |
56 | |
33 | |
29 | |
27 |