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
gracz
New Member

Dynamic REST Parameter in Power Query Editor

I have an Excel sheet where a user enters a number into a table which is in turn sucked into Power Query Editor and indexed such that it's a variable I can inject into other queries.

gracz_0-1626280405516.png

 

Now that I have my URL parameter set up I can inject it into the main query, which is a REST call, like so:

 

gracz_1-1626281757314.png

 

Or I could get rid of the param altogether and just call the Excel.CurrentWorkbook from within the main query:

gracz_2-1626281806482.png

 

Anyway you slice it, it works for me just fine. But fails for anybody I email it to.  It fails with the message:

 

 

Formula.Firewall: Query 'Query1' (step 'Added Custom') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

 

 

I'm unsure of how to inject the param from the excel sheet into the REST query without storing the param inside another query, which is exactly the problem the warning message is stipulating.  I've read other related questions like: 

https://community.powerbi.com/t5/Desktop/Formula-Firewall-Query-references-other-queries-so-it-may-n...

which had the main fix of:

https://www.excelguru.ca/blog/2015/03/11/power-query-errors-please-rebuild-this-data-combination/

Which doesn't apply here since I'm not merging queries, I'm combinging them textually, which really is the crux of the problem.

Any help would be appreciated.

Thanks,

-Matt

Edit: 7/19/21 - Formatting, rephrased a few points for clarity.

3 REPLIES 3
ImkeF
Super User
Super User

Hi @gracz ,

I would solve this by turning the firewall off.
This is exactly the case where in my eyes, this is justified.

 

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

@ImkeF  I didn't think of that.  And I appreciate the, rare as they may be, justified cases for firewall exceptions and the like.  However, that's not an option as the organizational structures around me won't permit it.

Your solutions implies that there's some property (or properties) of the file such that it doesn't play nice with the firewall when it's passed on to another user.  Do you have an idea of what such properties might be in play here?  For instance, the credentials for the REST API don't change when I pass it on to other users so that's unlikely to be a culprit. If you could identify some possibilities I could then maybe more surgically address the issue in the file, bypassing the need to modify the firewall.  Thoughts?

Hi @gracz ,

you can try to convert your URLTable into a function without any arguments (by putting a ()=> in front of it.
Then call it in your main query like so: 
URL = URLTable ()

 

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

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.

Top Solution Authors