Forum Discussion
Cloud Report Error "Invoked Custom Function references other queries"
I have several reports that are "invoking custom functions" to pull a list of information from one source and apply it to a second source. This has been a massive time-saver for our organization, allowing us to adjust massive numbers of reports by altering a single table.
As an example:
We have multiple tables spread across an ever-increasing number of schemas in our warehouse.
In Power Query/Power BI
Query1 runs a query against a table on our warehouse that contains a list of schemas
- SCH1
- SCH2
- SCH3
- And so on
Query2 is set up as a custom function (simplified code with proprietary info altered/removed):
let QRYLOOKUP = (parSCHEMA as text) =>
let
Source = Sql.Database("SERVERNAME", "database", [Query="
SELECT
Amount,
ActionDate
FROM
["&parSCHEMA&"].tblInformation
"])
in
Source
in
QRYLOOKUP
Query1 then can invoke the custom function and expand the fields to return these results:
| Schema | Amount | ActionDate |
| SCH1 | 300.00 | 5/1/2022 |
| SCH1 | 450.00 | 5/2/2022 |
| SCH2 | 275.00 | 5/1/2022 |
| SCH2 | 180.00 | 5/3/2022 |
| SCH3 | 190.00 | 5/2/2022 |
| SCH3 | 255.00 | 5/4/2022 |
| SCH4 | 315.00 | 5/3/2022 |
| SCH4 | 410.00 | 5/4/2022 |
Whenever I try to perform this action it works fine on the desktop, but the moment I upload it to the Cloud, I receive the following error when I refresh my data:
ERROR:
Underlying error message: [Unable to combine data] Invoked Custom Function references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.
I've rebuilt the queries a dozen different ways with no success. This is a recent change that appears to result from Microsoft screwing with the "partitions" for "security" and "privacy." Unfortunately, all it's done is break over 100 existing reports and force our lone developer, me, to have to manually rebuild all of the reports and their datasets, not only this time due to the breakage, but any time we add a new schema for our corporate structure.
Does anybody have a solution for this? This feature was one of the key reasons we opted to go with Power BI in the first place - dynamic queries.
3 Replies
- AnonymousNot applicable
Hi Anonymous ,
This blog explains why the error occurs and how to fix it. The reason is that you cannot combine an external data source with another query.
Similar post: Formula.Firewall: (step 'Invoked Custom Function'... - Microsoft Power BI Community
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
As I said, this worked until a few weeks ago. I have dozens of reports that functioned pefectly until the recent cloud update.
Further, that link isn't relevant for what I'm attempting. Before I posted this request, I had already found and went through the suggestions in the blog post buried deep in the link you supplied, and none of what was offered resolved the matter.
I intentionally supplied a complete, if simplified, version of my code for the purpose of explaining my specific problem, so that it would be possible to get to the fundamentals and assess a possible answer I could then extrapolate for my purposes. Your "solution" was to instead point me to an irrelevant link that is only peripherally related to the issue, and something that I had demonstrably solved on my own years ago.
Once again, I specifically stated that this particular problem is due to a "recent change" in the Power BI cloud software, and that I have a large volume of reports that had been working fine until an update to that software.
What has happened is that Microsoft saw fit in the last few weeks to "fix" something that wasn't broken, rendering dozens of my reports, reports that had been working seamlessly for years, useless the next time any of them require an update or alteration obviating a need to re-upload.
What you're telling me is that you have no answer other than "it never worked that way," despite a mountain of evidence I have to the contrary, and "I don't care to answer your specific question about what is clearly a recent problem, so here's a link from four years ago referring to a blog post from seven years ago."
- AnonymousNot applicable
Hi Anonymous ,
Sorry, I could not reproduce your issue...
I'd suggest you go to Support | Microsoft Power BI, scroll down and click "CREATE SUPPORT TICKET" for further help if you are a pro user.
Best Regards,
Stephen Tao