Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RafDelgado
Helper II
Helper II

Invoked Function Name in BI Desktop Queries

Hi All,

 

Does anyone know if you can specify the name of the invoked function when executing it?

 

At the minute, I have a couple of functions which are called Configuration and Servers. When invoking the functions, it generates the data table but the name of the query is "Invoked Function (#)" when ideally is need it to be Configuration (#) or Servers (#) to make it easier to work with the information. I know that you can manually change it but i have 43 invoked which means its a bit of a bore. Is there a way to scrip the function naming output?

 

 

Thanks,

 

Raf

 

 

1 ACCEPTED SOLUTION

Hi Raf,

I think we're on the same page here - just that I didn't make myself clear enough 🙂

 

Instead of using a function for creating the multiple webcalls with different page numbers, create a table with those parameters instead: manually, or like this #table({"URL", "PageNumber"},{{"yourURL", 100}, {"yourURL", 200}}) or dynamically with List.Generate or so.

 

Then you add a custom column where you invoke your function (with those 2 (or more) parameters from your columns passed into):

myWebCallFunction([URL], [PageNumber])

 

Check out this post: http://exceleratorbi.com.au/power-query-combine-web-pages/

There Matt first creates the function (which you probably have already) and then from 1:20 onwards first creates his parameter table (which just contains a list of different years) and then invokes his (1) function from within a calculated column.

 

Edit: So your page numbers will be like Matt's Year numbers.

 

BTW: You can use List.Generate for an iterative calling of your web-pages where it checks with each call if there is more content to come and then perform the next step if yes or stop if no. Had that somewhere in the TechNet-forum but cannot remember any more. But maybe Chris' article will tell you all you need already: https://blog.crossjoin.co.uk/2014/06/25/using-list-generate-to-make-multiple-replacements-of-words-i...

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

5 REPLIES 5
ImkeF
Super User
Super User

Not sure if I understood you correctly, but you have to type in the names of your queries (function invokes) manually.

 

But I'd suggest to reduce the number of queries/function invokes to the number of distinct functions you have. So not to invoke the same function twice. Instead create a table with the different parameters that now justify your 43 different calls and add a column where your function is invoked. This would basically transfer your desired different query-names into a column of your new (big) table that can be used for filtering in your reports.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Thanks for the response Imke, much appreciated :). All I was after was confirmation that when invoking a function there was no way to keep the invoked name rather than the "Invoked Function" name it gives the new query. In previous versions of the desktop, a function would have called itself and updated the same query not create a new one thats all.

 

To elaborate a bit more, I was using a web data source to query a json based API site. The max number of values I could return on each call was 50 but didn't know specifically how many invokes I would need. I created a function with the web URL and used a parameter for the number of the page in the header which is why I needed to invoke so many times. I then appended the functions to a new table and renamed that, turning the rest of the invoked functions off. This wasn’t ideal but did the job. It would have been useful if they were called that actual name of the function thats all.

 

Thanks again for responding!

 

Raf

 

Hi Raf,

I think we're on the same page here - just that I didn't make myself clear enough 🙂

 

Instead of using a function for creating the multiple webcalls with different page numbers, create a table with those parameters instead: manually, or like this #table({"URL", "PageNumber"},{{"yourURL", 100}, {"yourURL", 200}}) or dynamically with List.Generate or so.

 

Then you add a custom column where you invoke your function (with those 2 (or more) parameters from your columns passed into):

myWebCallFunction([URL], [PageNumber])

 

Check out this post: http://exceleratorbi.com.au/power-query-combine-web-pages/

There Matt first creates the function (which you probably have already) and then from 1:20 onwards first creates his parameter table (which just contains a list of different years) and then invokes his (1) function from within a calculated column.

 

Edit: So your page numbers will be like Matt's Year numbers.

 

BTW: You can use List.Generate for an iterative calling of your web-pages where it checks with each call if there is more content to come and then perform the next step if yes or stop if no. Had that somewhere in the TechNet-forum but cannot remember any more. But maybe Chris' article will tell you all you need already: https://blog.crossjoin.co.uk/2014/06/25/using-list-generate-to-make-multiple-replacements-of-words-i...

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Very elegant solution!

 

I've been stuck with a similar issue, where I had to invoke ALOT of functions with many tables and the append all together. With this I can just append and clean at the same time.

 

Thanks!

AHH! Now I get you! What an awesome way of going about it :). Will give it a shot and try it that way, thanks again for the suggestion 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.