Forum Discussion
Custom Power Query Code for refresh not to fail when there is no source data files
- 6 years ago
Hi Mann
Then you add a last step to your queries that checks for existing errors and in case of error, produces an empty table. Usually it is necessary to have the column names still in place. You can hardcode such a table like so:
#table( {"ColName1, ColName2..."}, { { } } )
The step would look like so:
try <PreviousStepName> otherwise #table( {"ColName1, ColName2..."}, { { } } )
Hi ImkeF
Do you know a solution to another scenario - return old data (vs. return an empty table) in Power BI? I can solve it in PBI Dataflows and Excel PQ, but can't figure out for PBI Desktop.
Thanks,
JB
Hi Anonymous
easiest would be to let it run into error, so the old data would be kept.
But if you're interested in incremental load, this article leads you to a couple of hacks/workarounds for Power BI: https://www.thebiccountant.com/2017/01/11/incremental-load-in-powerbi-using-dax-union/