Forum Discussion
Power Query Editor cannot be used
- 6 months ago
hi ChenwuZhu_Gmail ,
it was suggested like:
The "Collection was modified; enumeration operation may not execute" error on apply typically stems from conflicts between Tabular Editor’s schema changes and Power BI’s internal data model state. Below is a structured, step-by-step solution to recover your queries, fix the error, and prevent recurrence, tailored to your scenario:Step 1: Immediate Recovery (Retrieve Disappeared Power Query Queries)The queries are not permanently deleted—they’re hidden due to a schema mismatch between Tabular Editor and Power BI. Follow these steps to restore them first:Option A: Restore from Auto-Recovery (Fastest)
Power BI Desktop auto-saves recovery files. Here’s how to access them:- Close Power BI Desktop completely (ensure no background processes are running via Task Manager).
- Navigate to the auto-recovery folder (Windows):plaintext
%LocalAppData%\Microsoft\Power BI Desktop\AutoRecovery
- Look for .pbix files with timestamps matching before you used Tabular Editor. Open the most recent one—your queries should be intact here.
This usually happens when partitions created/edited via Tabular Editor leave the model in a state that Desktop’s Power Query layer (the “M queries”) can’t reconcile. Then, when you hit Apply changes, Desktop tries to enumerate/refresh the query collection and throws.
1) Open the PBIX and undo partition changes
If you can still open the file:
Go to External Tools → Tabular Editor
Find the tables you partitioned
Set them back to a single partition (default), or remove the added partitions
Save back to PBIX
Re-open Desktop and try Transform data again
2) If Power Query UI is already broken: recover via a “clean copy”
A reliable workaround is to rebuild the mashup without losing the model:
Create a new PBIX
Copy your Power Query (M) from the old file if you can access it (sometimes you can via Advanced Editor / or from the PBIX contents)
Then re-apply model changes carefully