Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

DataSource.Error: Invalid column name

Hi, this is quite an annoying error...

have made some changes to the data source (in my case  SQL view)

have edited my reports and all works fine

but now when I open 'Power Query Editor' I get this error:

 

DataSource.Error: Microsoft SQL: Invalid column name 'MyCol'.
Details:
DataSourceKind=SQL
DataSourcePath=MySqlServer
Message=Invalid column name 'MyCol'.
Number=207
Class=16

 

of course  MyCol is no longer needed, but I cannot tell the query editor to ignore that or to refresh.

It seems that the only option is to delete the source and then re-import it, that would mean a lot of lost work (for example calculated columns).

 

is there any workaround for this problem?

Thank you

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

I make a simple test as below: "import/ direct query" all works for following steps

i connect to SQL with Power BI Desktop,

then i delete one column from the data source,

after clicking "refresh" button on "Home" menu and "Refresh all" inside the "Edit queries",

it works and show the lastest table with one column disappeared in Power BI.

 

"

step1: have made some changes to the data source (in my case  SQL view)   

        (delete a column? change the column name?)

 

step2: have edited my reports and all works fine             

         (do you refresh from Power BI after step1?

          if you add the column which was deleted in step1 to a visual, does it give any error?) 
"

Could you show some details what you do for the steps above so i can reproduce your problem?

 

Best Regards

Maggie

 

 

 

View solution in original post

9 REPLIES 9
Subhraz
Advocate I
Advocate I

Hi,

 

I faced the similar error and here's what I did.

1) Take a backup of your pbix file.

2) Go to Edit Queries and delete the dataset. This would take off your report and would show fix it. Let it be that way.

3) If it's a SQL view you drop and recreate it.

4) Get your dataset again. This would automaticlly bring back your report.

5) Go to Edit Queries and you can see that the error is no longer there.

 

Thanks,

Subhraz

If its SSAS Tabular in visual studio...

 

1 - copy out the M query from the advanced tab, something like 

let
Source = #"SQL/dn1dwhost01d;datawarehouse",
powerbi_Transactions = Source{[Schema="powerbi",Item="Transactions"]}[Data]
in
powerbi_Transactions

 

2 - Delete the query and create a new query

3 - Add the M query in the advanced tab

4 - Refresh Preview

 

Axit
Advocate II
Advocate II

The easiest way to fix this is just to refresh the preview.

 

So go Edit Queries>Refresh Preview

Axit is out here DOING THE WORK.  Smarter, not harder folks!  Thanks!

Anonymous
Not applicable

Fixed my issue! Great Answer.

Legend!

v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

I make a simple test as below: "import/ direct query" all works for following steps

i connect to SQL with Power BI Desktop,

then i delete one column from the data source,

after clicking "refresh" button on "Home" menu and "Refresh all" inside the "Edit queries",

it works and show the lastest table with one column disappeared in Power BI.

 

"

step1: have made some changes to the data source (in my case  SQL view)   

        (delete a column? change the column name?)

 

step2: have edited my reports and all works fine             

         (do you refresh from Power BI after step1?

          if you add the column which was deleted in step1 to a visual, does it give any error?) 
"

Could you show some details what you do for the steps above so i can reproduce your problem?

 

Best Regards

Maggie

 

 

 

Apologies for resurrecting an old thread but I've encountered this issue myself and have found a working solution that has resolved the issue. Post deployment we've had some columns removed from an on-prem database which has led to this error appearing as the columns are no longer available when connecting to a table.

 

For anyone who encounters this error and it displays in Power Query transformation try clearing the permissions on your data source and re-authenticate the connection. This has resolved the invalid columns error for me.

Anonymous
Not applicable

Hi, i used refresh after deleting the column, still got the error...

is there any difference between the "refresh" on the main window and the "refresh all" on Query Editor window?

 

I ended up adding a dummy null column to my view with the same name to avoid recreating all.

but of course this is a some what crooked solution

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.