Forum Discussion
Conditionally creating queries
- 4 years ago
Hi JimJaggers ,
You can't control the actual creation of queries per se, but you can have all the queries already in place and conditionally populate them using error handling i.e. you would set up the query with the source as 'Tab C', but then put an evaluation into the query that says "if the Tab C source returns an error (i.e. tab not present) then just run as blank" or similar.
Generally accepted technique on Chris Webb's blog here, but make sure to read the comments as Ken Puls adds some crucial adjustments to the method:
https://blog.crossjoin.co.uk/2014/09/18/handling-data-source-errors-in-power-query/
Pete
Hi JimJaggers ,
You can't control the actual creation of queries per se, but you can have all the queries already in place and conditionally populate them using error handling i.e. you would set up the query with the source as 'Tab C', but then put an evaluation into the query that says "if the Tab C source returns an error (i.e. tab not present) then just run as blank" or similar.
Generally accepted technique on Chris Webb's blog here, but make sure to read the comments as Ken Puls adds some crucial adjustments to the method:
https://blog.crossjoin.co.uk/2014/09/18/handling-data-source-errors-in-power-query/
Pete