Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Good morning,
I am busy experimenting with invoking functions in Power BI. I am trying to find a method of Referencing a Query using Invoked Functions.
I thought I could use the following:
= (strQueryName, strFieldName) =>
let
Source = strQueryName
in
Source
the strFieldName is a field in said query... and once I am able to reference said query I can begin using it.
However, when I attempted to use this code - it treated the strQueryName as Text - and so the function simply returns the text of the parameter. Is there a data type I need to set the parameter to correctly reference the query?
Thank you for any help that can be provided
Kind regards,
Paul
Solved! Go to Solution.
Hi @paulvans182
Sorry, probably misunderstood the original requirement.
try this
= ( strQueryName as table ) =>
let
Source = strQueryName
in
Source
Hi @paulvans182
Sorry, probably misunderstood the original requirement.
try this
= ( strQueryName as table ) =>
let
Source = strQueryName
in
Source
I have a very similar situation, but instead of trying to reference a query/table, I want to reference a Parameter defined in my PowerBI file (not a function parameter).
So I basically have a parameter that
TrainA = "ID OF TRAIN A"
TrainB = "ID OF TRAIN B"
and I would like to be able to tell which of the 2 parameters should my function use.
like
myTable = CallMyFunction("TrainA"). Inside my function, I do NOT want the text "TrainA" but rather the ID of train A.
I dont see a parameter type of "parameter" as you proposed with the table type. Any way around this?
Hi @paulvans182
No problem at all.
Hi @paulvans182
Please see the attached file with the example of Invoke custom function.
Hi @Mariusz ,
Thank you for the suggestion - however, unless i am misunderstanding, your solution appears to add a new column to the already existing table.
What I am looking to do, is to create a new query with the same data as the existing query (essentially a duplicate or reference of the query) that I can then manipulate separately. So, effectively I would have your original Table query, and a new query that looks identical to Table after I invoke the function using the queries name, "Table" as the parameter.
Does that make sense? Thanks again for any help you can provide
Kind regards,
Paul
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |