Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi guys,
We know that when a query cannot simultaneously access an external data source (external files, excel tables, etc.) and another query from the power query list (power query editor).
Doing so will raise the "...may not directly access a data source" error.
However this limitation is ridiculous, especially for shared queries. By shared I mean queries that are stored in text files and called with code such as:
(TargetTable as table, TargetCol as text, LookupTable as table, LookupOldCol as text, LookupNewCol as text) => let GetFunction = Text.FromBinary(File.Contents(Excel.CurrentWorkbook(){[Name="PQMacrosFolder"]}[Content]{0}[Column1]&"GetCSVByDateAndName.txt")), EvaluateFunction = Expression.Evaluate(GetFunction, #shared), EvaluateFunction2 = EvaluateFunction(TargetTable, TargetCol, LookupTable, LookupOldCol, LookupNewCol) in EvaluateFunction2
Shared queries by definition are referring to an external data source (the text file). So then how can I use a shared query that will act on another query? This need is very realistic. Imagine you wrote a PQ macro that modify a table (a query) in some way. Now you wanna store it in a central location to re-use (in the same way you store VBA macros in xlam file). However this is never possible with the current power query architecture.
Anybody has a work-around?
Hi @freelensia,
As I understand your question you want all the queries to be stored in one central location so that it can be re-used multiple times?
According to me, there are two ways to do this.
1. Custom function: you can create custom functions and then it can be re-used in other queries
2. Data Flows: this is like, Power Query on the cloud. Where anyone within the organisation can use this.
Hope that answers your question
Regards,
Pradip Microsoft Certified Trainer
Thanks for the quick answer.
1. Yes I have created custom functions. However they can only be used in one Excel workbook, not multiple.
2. Data flows are not free, am I correct?
If so, these 2 suggestions do not solve my issue.
Hi @freelensia
I though you're working in Power BI. Data flows only available in Power BI cloud. I am sorry i ran out of suggestions.
Regards,
Pradip Microsoft Certified Trainer
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
61 | |
40 | |
40 | |
28 | |
16 |