Forum Discussion
SQL Direct Query Error
Hi all,
I’m using SQL Server with DirectQuery, and after adding new columns to some tables, Power BI started showing:
“Invalid column name” for the newly added columns.
What’s strange is:
- The new columns appear correctly in Power Query
- Refresh fails only in DirectQuery
- Import mode works without any errors
- If I delete all tables and reconnect the DB from scratch, and re-write all the measures it works again
- The same PBIX works on one colleague’s laptop but fails on another
Schema is identical across environments.
Any idea how to fix it without rebuilding the whole model?
Thanks!
- Anonymous8 months ago
Hi dhruv_-_ ,
Try these before rebuilding to fix the issue.
1. clear file-specific cache.
File → Options → Current File → DirectQuery → Clear cache
Restart again.
2. Disable SQL Server folding cache
Go to:
File → Options → Global → Preview Features
Disable:
Improved model metadata
DirectQuery query reduction (if enabled)
Restart Power BI.
3. In Model View, for each affected table:
Select table,
Click Refresh in the Properties pane (this is a metadata refresh, not data refresh)
OR
Remove one column and add it back (forces schema reload).
4. In Model View, for each affected table:
Select table
Click Refresh in the Properties pane (this is a metadata refresh, not data refresh)
OR
Remove one column and add it back (forces schema reload).5. Ensure all machines use the same Power BI Desktop version
Some versions had DirectQuery metadata bugs.
If my response as resolved your issue please mark it as solution and give kudos.
7 Replies
- AnonymousNot applicable
Hi dhruv_-_ ,
Try these before rebuilding to fix the issue.
1. clear file-specific cache.
File → Options → Current File → DirectQuery → Clear cache
Restart again.
2. Disable SQL Server folding cache
Go to:
File → Options → Global → Preview Features
Disable:
Improved model metadata
DirectQuery query reduction (if enabled)
Restart Power BI.
3. In Model View, for each affected table:
Select table,
Click Refresh in the Properties pane (this is a metadata refresh, not data refresh)
OR
Remove one column and add it back (forces schema reload).
4. In Model View, for each affected table:
Select table
Click Refresh in the Properties pane (this is a metadata refresh, not data refresh)
OR
Remove one column and add it back (forces schema reload).5. Ensure all machines use the same Power BI Desktop version
Some versions had DirectQuery metadata bugs.
If my response as resolved your issue please mark it as solution and give kudos.
- Praful_PotphodeSuper User
hi dhruv_-_
try changing the column name to something unique and then try.If this works, then there could be chances that you have renamed the column directly in desktop and its conflicting with it.
another option you can try is uncheck Enable Data load option in power query and close and apply.this will remove the table from desktop.then again check the Enable Data load option in power query and close and apply.
Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
- Kedar_PandeSuper User
- dhruv_-_New Member
Thanks Kedar_Pande but I have tried doing that as well but still didn't work.
- kushanNaSuper User
Hi dhruv_-_
If you are using SELECT * try to do this ? https://www.reddit.com/r/excel/comments/epkj91/power_query_sql_error_but_no_changes_to_the_sql/
- v-priyankataCommunity Support
Hi dhruv_-_
Thank you for reaching out to the Microsoft Fabric Forum Community.
Kedar_Pande Anonymous kushanNa Praful_Potphode Thanks for the inputs.
I hope the information provided by users was helpful. If you still have questions, please don't hesitate to reach out to the community.
- v-priyankataCommunity Support
Hi dhruv_-_
Hope everything’s going smoothly on your end. I wanted to check if the issue got sorted. if you have any other issues please reach community.