November 2, 2021
Hi all.
I'm having a problem with a Power Query connection between workbooks - Power Query seems to be loading the wrong data and I cannot find the error
In the source workbook there is a column that contains an IF formula which calculates whether the row is overdue or not (based on the difference between TODAY() and another column that holds the target date for that row). The output of the formula is either "Overdue", "Due within 5 days" or "Due in over 5 days".
When I try to load the data from this table into another workbook using Power Query, it loads the wrong value for that column. This doesn't happen for all rows - most are accurate. From what I can tell, it's only happening for rows that have changed value in the last few days. For example, the most recent entry appears in Power Query "Due within 5 days", but in the source workbook it appears as "Overdue". Obviously I thought there must be some problem with the workbook that the query was in, but even when I re-build this query from scratch in a new blank workbook, I get the same incorrect data.
I'm not doing any value-replacement or anything like that, and I can't see where the error could come from. If I just use a basic linked cell (by typing "=" into a cell in the destination workbook, and then selecting the relevant cell in the source workbook) it reads the data across just fine. Any idea why Power Query wouldn't do the same?
Thanks in advance!
Ryan
Trusted Members
Moderators
November 1, 2018
November 2, 2021
Hi Velouria - certainly not a stupid question! It's in both places. I initially noticed it in the query results (the query is loaded to a worksheet), and then traced it back in the query editor. There were some transformations in the query, but I stripped all of those out and the error persisted. Then I re-built it from Source upwards and it still persisted! The I did the same thing in a new blank workbook... and still the error!
The source file is sitting on a shared file server - is it possible that there's some strange caching problem? I find this kind of error the most maddening of all because it makes me worry that the rest of the data load is not reliable. Any help appreciated!
Trusted Members
Moderators
November 1, 2018
I'd probably start by clearing the cache in your Query Options. If that doesn't help, try copying the source file locally and linking to that to see if the problem is still there.
I note you are using the TODAY() function which is volatile when the workbook is open (i.e. recalculates whenever the workbook does) but is not of course when the workbook is closed. I assume the workbook is being opened and saved daily before you try and query it? If not, perhaps you'd be better off calculating the column in the query itself to ensure it's always up to date.
Answers Post
November 2, 2021
Clearing the cache doesn't do it, but I think you're right about the problem being how the formula calculates. I think what's happening is that Power Query is loading the value of that cell as it stood when the file was last saved, rather than how it displays in the current session.
I was expecting a different behaviour because with a linked cell the values update as soon as you open the source workbook (even if those changes are not saved), but the same thing doesn't seem to happen with Power Query - you have to open the source file, let it calculate, and then save it with the changes before they will appear in the query.
Unfortunately that's not an option for me! I'm just going to recreate the calculation inside Power Query, instead of relying on it to load that calculated column correctly
Thanks for helping me think through it!
1 Guest(s)