PDA

View Full Version : PowerQuery refresh / Pivot Table refresh



fb7894
06-14-2018, 06:22 AM
I'm having a problem where my VBA code refreshes my PowerQuery query and then refreshes the pivot table that uses the query results.

Problem is the vba code does not wait until the PQ refresh is complete. So my pivot table refreshes before the new data is available.

Is there a solution to this other than Application.Wait ? The Enable Background refresh is unchecked but that makes no difference.

Aflatoon
06-14-2018, 06:51 AM
What is your code?

fb7894
06-14-2018, 07:13 AM
With ThisWorkbook
Set ptFees = shtptFees.PivotTables("PTFees")
.Connections("Query - tblProducers").Refresh
ptFees.PivotCache.Refresh
End With

Aflatoon
06-14-2018, 07:53 AM
Are you building pivots directly off the PQ data, or is PQ dropping the data into a table, and you then pivot off that table?

fb7894
06-14-2018, 10:06 AM
The PQ data is loaded directly into a PT.