“I Modified an Existing Table in Power Query and Now it Won’t Refresh”– A Fix

Guest Post by Ted Eichinger

Note, this fix to re-establish a broken connection is performed using Excel 2010

It’s the same old story, I mashed and twisted some data through Power Query, pulled it through Power Pivot, spent hours creating calculated columns and measures, made a really nice Pivot Table with conditional formatting and all the bells and whistles.  Then I show it to the Business Manager that requested it, and he wants me to add a field that I didn’t pull in through Power Query.  I’m going to have to change my Power Query which is going to break my Power Pivot connection, and then I’ll be spending hours to rebuild my model from scratch!

This happens to me more that I’d like.  I’ve searched the far reaches of Google, only to find a lot of threads asking about how to fix, but I’ve never seen an answer.  Most threads end with no,  you just can’t do that.  Just playing around on a hunch, I figured out a way to fix it without having to rebuild the model!!!  Some already know the “fix”, for those that don’t , I’ll walk through the method that’s been working for me.

If you want to follow along download the file below, I’ve used some public data on camera lenses so anyone can refresh the data model (use Anonymous access if prompted), or follow along just using the pictures.
Yes You Can Example.xlsx

In this example a Business Manager wants me to add the field, “Closest Focus” to the Power Pivot table.

Power Pivot Rejected by Business Manager

This is the Power Pivot table that requires an additional field

This should be easy, just open the Power Query (in the example file) named, “Macro photography lenses”, and delete the “RemovedColumns” step and the “Closest Focus” column should now be back.

 Power Query reveal column

“Closest Focus”, has now been added.

Save that Power Query.  Open the Power Pivot window, there is only one table, let’s refresh it.

Power Pivot Error After Editing Power Query

The dreaded Power Pivot error!

This will always happen anytime we make any kind of change to a Power Query that is connected to a Power Pivot table.  If you’re working with Excel Power BI tools you’ll eventually see this error.  The error detail reads:

The operation failed because the source database does not exist, the source table does not exist, or because you do not have access to the data source.

More Details:

OLE DB or ODBC error: The query ‘Macro photography lenses’ or one of its inputs was modified in Power Query after this connection was added. Please remove and re-add the connection. This can be done by disabling and re-enabling download of ‘Macro photography lenses’ in Power Query..

The FIX!!

To fix this error, in the Power Pivot window, Go to Design > Existing Connections

Under Workbook Connections select the Power Query (in this workbook, Power Query – Macro photography lenses)

Click Open

Power Pivot Corrected Power Query Connection String

This is the “new” corrected connection string

Copy the Connection String

Then click Cancel, we don’t want to re-import that table again.

I think this is where the magic happens.  If I’m thinking this correctly, when I changed the Power Query, I changed the connection string, so this is a copy of the new (corrected) connection string.

Then go back to Design > Existing Connections

Now we go under PowerPivot Data Connections and select our broken Power Query connection, and then click Edit

In the Edit Connection dialog window, delete the old connection string and paste in the new connection string.

 Power Pivot Corrected Power Query Connection String

This is the message you should see after you have pasted the new connection string

When you’re done a message will appear in the bottom dialog,  click Save.

Close the Existing Connections Window

Go back to Home > Refresh

 Power Pivot Data Refresh Success After Editing Power Query

Data Refresh dialog should appear with the Success message

… And then everything is AWESOME again!! I see Emmet dancing around and I hear that song from The Lego Movie playing in my head.

And everything is back to the way it was, I don’t have to spend hours to re-build my model, even the pivot table is intact!

Wait…. One more step before everything is truly awesome!  The new field that I added to Power Query is now missing in my Power Pivot model.

Easy to fix Missing Field(s)!

Go to Design > Table Properties

“Closest Focus” is not checked, just check it.

 Power Pivot add hidden columns to model

Just make sure all columns you want visible in your Power Pivot model are checked 

Click Save, and NOW everything is awesome!

And here is what Emmet has to say!

13 Responses to “I Modified an Existing Table in Power Query and Now it Won’t Refresh”– A Fix

  1. GDRIII says:

    Everything is Awesome, when you’re PowerPivoting!!!

  2. Gita Mooney says:

    Could you help me resolve an issue with something similar. I connected an excel spreadsheet which resides on the BI server to a data model also on the Bi server. It refreshes fine if I pull the data model down to our machine but fails when I try to setup auto refreshes on the server. Here is the error message.

    OLE DB or ODBC error: Failure creating file.; 3436. A connection could not be made to the data source with the DataSourceID of ’73e87f62-05ac-4ed3-bf5f-8152ef3c82c2′, Name of ‘Excel ATT2014TABLES’. An error occurred while the partition, with the ID of ‘BMS Only_ee478831-c49e-4d64-8525-14bb2e3cfb6a’, Name of ‘BMS Only’ was being processed. The current operation was cancelled because another operation in the transaction failed.

    I tried what you have in the article above but the connection string was exactly the same,

    Any help you can provide will be appreciated.

  3. GDRIII says:

    Gita, Try the Power Pivot forum at Mr. Excel. Good folks over there. Quicker response.

  4. Matt Allington says:

    This is excellent Ted. Yes I have had this issue and never found a solution, and that has made me nervous to use Power Query. Thanks for the tip.

  5. milhouse77bs says:

    For Excel 2013, with latest Power Query, it seems that if I get a similar error, it tells you to disconnect the Power Query. So uncheck the Load to Data Model. Refresh the query. Then reconnect the Load to Data Model, and the refresh works! After I do it once, it seems to take most of the changes to the Power Query in stride…

  6. Konstantinos says:

    Correct me if I am wrong but that solution doesn’t work on 2013 excel. The official answer is that the below reasons can break the query (no turning back ) The solution is to make this changes and actions with power query.

    •Edit Table Properties
    •Column-level changes: Rename, DataType change, Delete
    •Table-level changes: Rename, Delete
    •Import more tables using PP Import Wizard
    •Upgrade existing workbook.

    After applying all the above I never had any problems with the data model. Any change in power query doesn’t affect calculated columns or calculated fields.

  7. Rick says:

    I’m afraid this doesn’t work with the newest version of Power Query Version: 2.14.3722.242. Doesn’t seem to support loading to the Data Model at all… Please let me know if anyone has a workaround.

  8. Rick says:

    I discovered that as long as you load it to the worksheet once you can then subsequently edit the query, uncheck load to worksheet, and then follow the steps in the post above. In cases where the query returns a huge table it works to simply add a step at the end of the power query that removes all but the top 2 rows, load to worksheet, create the power pivot connection, edit the query to remove that last step of the query, then edit the connection as described above. Hope that helps.

  9. Phil says:

    This is killing me. When I try the above approach, I can modify the the connection in the advanced dialog, and the test connection succeeds. But once I return to the Edit Connection dialog and click save, I get an error saying I need to provide a database name.

  10. Phil says:

    I’m changing my approach. Step 1: load Power Query results to worksheet. Step 2: load Power Query results table as a linked table to Powerpivot model. Seems to work so far. Any reason this is a bad idea?

  11. Brent Pearce says:

    Linked table limitations:
    1) limited to <1M records
    2) refresh is not consistant. I often can't get a linked table to refresh untill I open the PowerPivot Window. Not something I want to force my users to do…

  12. RubenC says:

    Great Fix!!! Thsnk for the Tip

Leave a Comment or Question