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
Heyam
Frequent Visitor

Error: Formula.Firewall: Query (step 'Invoked Custom Function')

Dear all, 

I'm trying to use Text Analysis Cognitive Services in Power BI Desktop, but I'm having this error since a long time, and I have tried some solutions but it did'n works. 

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

 

I were following the steps excatly as it's listed in this tutorial link:

https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/tutorials/tutorial-power-bi... 

 

 

and I've visited Ken Puls blogg as it solved a similar problem posted by a regular visitor.

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

 

but it's not the same problem I have since my code does't contain a 'source' :

// Returns key phrases from the text in a comma-separated list
(text) => let
apikey = "API_KEY",
endpoint = "https://<custom-subdomain>.cognitiveservices.azure.com/text/analytics" & "/v2.1/keyPhrases",
jsontext = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
jsonbody = "{ documents: [ { language: ""en"", id: ""0"", text: " & jsontext & " } ] }",
bytesbody = Text.ToBinary(jsonbody),
headers = [#"Ocp-Apim-Subscription-Key" = apikey],
bytesresp = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
jsonresp = Json.Document(bytesresp),
keyphrases = Text.Lower(Text.Combine(jsonresp[documents]{0}[keyPhrases], ", "))
in keyphrases

 

 

 

 

Any Suggestions please! 

6 REPLIES 6
Icey
Community Support
Community Support

Hi @Heyam ,

 

To be honest, I just know a few about this. If you are a pro user, I suggest you to create a support ticket to get further help.

 

Support Ticket.gif

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Heyam
Frequent Visitor

@Icey ,

Unfortunately, I'm not a pro user.

So, should I just give up on finding a solution to my issue!

Icey
Community Support
Community Support

Hi @Heyam ,

 

Sorry didn't help you solve the problem. Hope these super users could help you: 

@Greg_Deckler@MFelix@amitchandak@parry2k .

 

 

Best Regards,

Icey

@Heyam seems like your firewall issue is resolved? correct? Do you any error when you preview in power query? 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Icey
Community Support
Community Support

Hi @Heyam ,

 

Please try this:

ignore.PNG

If this doesn't work, please try to create a custom column as fixed Text and try it again.

let
  text = [comment]
  apikey = "API_KEY",
  endpoint = "https://<custom-subdomain>.cognitiveservices.azure.com/text/analytics" & "/v2.1/keyPhrases",
  jsontext = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
  jsonbody = "{ documents: [ { language: ""en"", id: ""0"", text: " & jsontext & " } ] }",
  bytesbody = Text.ToBinary(jsonbody),
  headers = [#"Ocp-Apim-Subscription-Key" = apikey],
  bytesresp = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
  jsonresp = Json.Document(bytesresp),
  keyphrases = Text.Lower(Text.Combine(jsonresp[documents]{0}[keyPhrases], ", "))
in
  keyphrases

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Heyam
Frequent Visitor

Thank you @Icey , your second suggestion worked with well, but it turn an error when apply it. 

 

 

Capture3.PNG

 

Please notice that I'm working on 20,000 records (rows), and planning to implement the query on 130,000 records later on.

Is it a problem? while I'm calling API version v2.1 endpoint from the code, v2.1 has no maximum limit !

And if I copied the Endpoint as it's in Azure portal, it doesn't contain the location like http://westus.domain.

 

Regards,

 

 

 

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.