Forum Discussion
Pivot Table Will Not Update Properly
- Jun 06, 2018
I always had the exact same problem and finally found the solution, which appears to be embarrasingly simple.
Click Change Data Source. After updating my data (obviously) the data range has expanded! Select the data set again and voilà.
Hello SergeiBaklan, I wanted to post some VBA code I use to disable background refresh for all of my connections in case anyone would find it useful. I run this code on a regular basis as Excel seems to change this every time I decide to touch a query ☺ When you have many queries, this sure does come in handy!
Sawcy1
HSawcy1 I have same issue, Refresh All is not refreshing my the data source in my power query which is connected to my pivot table in excel.
I followed the same steps you provided which is to uncheck the box enable background refresh but it did not help.
Do you know any further steps I can take to solve this please?
- Sawcy1Mar 15, 2021Copper ContributorHello Yemisi13, turning off background refresh will not fix an issue with the data source itself not being updated as you mentioned is happening in your situation. I would check the query that provides the data to your pivot table. When you open the Workbook Queries pane, or go into the Power Query Editor, does that query have errors? If so, they will need to be corrected. After fixing any query issues, I recommend running the VBA code I provided to make sure background refresh is turned off again for all your queries. I have found that Power Query often turns background refresh back on again when you touch a query.
Sawcy1- Yemisi13Mar 15, 2021Copper Contributor
Sawcy1the file does not open could you post it again please.
Thank you
- Sawcy1Mar 15, 2021Copper ContributorYemisi13, it is a macro file so you need to have Excel open and use the VBA editor to see the code.
I am posting the code here for your convenience.
Sawcy1
Sub Set_Connection_Property_Disable_Background_Refresh()
Dim con As Object
For Each con In ActiveWorkbook.Connections
If con <> "ThisWorkbookDataModel" Then
With con
Debug.Print con.Name
If con.OLEDBConnection.BackgroundQuery = True Then
MsgBox "Background Refresh was on for " & con.Name & ". Turning off now."
End If
Debug.Print con.OLEDBConnection.BackgroundQuery
con.OLEDBConnection.BackgroundQuery = False
Debug.Print con.OLEDBConnection.BackgroundQuery
Debug.Print "-----------------------"
End With
End If
Next con
End Sub