Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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!
Hi lnedeah,
We are checking if you had a chance to try the solutions and solve your problem. If you found a solution, please share it with the community to help others with the same issue.
If our response helped you, please mark it as the accepted solution. This will help the whole community.
If you have any more questions, feel free to ask the Microsoft Fabric community.
Thank you.
Hi lnedeah,
We are following up to check if you had a chance to try the solutions and resolve your query. If you found a solution, please share it with the community to help others with similar issues.
If our response was helpful, kindly mark it as the accepted solution. This will benefit the wider community.
If you have any more questions, please feel free to reach out to the Microsoft Fabric community.
Thank you.
Hi lnedeah,
Thank you for the update.
Please try the solutions and let us know if you are able to fix the issue once you return.
Thank you.
Hi all, sorry I've not had a chance to try any of these solutions as I've been busy with other projects. I'm going on leave, so I will try and report back when I return. Thank you for the support. Lydia
Hi lnedeah,
We wanted to check with you because we have not received any reply. If your problem is solved, please share the solution with the community. This will help others who face the same issue.
If our answer helped you, please mark it as the accepted solution.This will guide other members too.
Thank you.
Hi lnedeah,
We have not received a response from you regarding the query and were following up to check if you have found a resolution. If you have identified a solution, we kindly request you to share it with the community, as it may be helpful to others facing a similar issue.
If you find the response helpful, please mark it as the accepted solution, as this will help other members with similar queries.
Thank you.
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
CheckIfEmptyThis 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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!