Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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