It is easy to develop function inside PowerBI. To reuse your code; or execute logic at a row basis.
It becomes harder when you are developing and changing functions with parameters. That’s mainly because you cannot step through a function line by line and see the intermediate results.
With this little trick, you can easily develop and simply copy paste the code into the function.
Create the function scaffolding
Setup a blank function with the function parameters you want to use.
Source = (
#”SharePoint tenant” as text,
#”Site name” as text,
#”List name” as text
) => “scaffolding”
in
Source
Setup development query
You can setup a query with fixed parameters, copy the parameters from you scaffolding and make them into variables.
#”SharePoint tenant” = “tenant.sharepoint.com”,
#”Site name” = “MySite”,
#”List name” = “MyList”,
// inner function code
Source = “scaffolding”
in
#”Source”
Now you can develop and test your function using the variables. When you want to go to production, you copy the innards (excluding the variables) and paste them into your function.
Conclusion
With this little trick you can quickly dive into the intricate logic of your function.