none
Expression.Error: Cannot convert the value "[Function]" to type Function RRS feed

  • Question

  • Dear M experts, 

    I am trying to consume a Marketplace ML service to score some tweets in Power BI Desktop. The code I am using to build the function is 

    let
        Source = Marketplace.Subscriptions(),
        TextAnalytics= Source{[ServiceUrl="https://api.datamarket.azure.com/data.ashx/amla/text-analytics/v1/"]}[Feeds],
        SentimentFunction = TextAnalytics{[Name="GetSentiment",Signature="function (text as text) as record"]}[Data]
    in
        SentimentFunction

    When I invoke it manually through the Power BI invocation menu it works perfectly. 

    Then I add a Custom Column trying to pass the tweet text to the function and retrieve its scoring with the following code

    = Table.AddColumn(#"Changed name columns", "Sentiment", each SentimentFunction([Tweet]))

     I get the following error

    "Expression.Error: Cannot convert the value "[Function]" to type Function

    Details:

    Value=[Function]

    Type=Type" 

    I can guess I probably have to add something else so the value returned is not a string with the value function but I am not able to see it yet. 

    ¿Have you ever faced this error? ¿Any advice? 

    Thank you all in advance

    Regards

    Pau Sempere

    Monday, November 2, 2015 4:51 PM

Answers

  • Hi Pau,

    I believe that you're hitting the PQ firewall. In order for this to work, make sure that the privacy level for both data sources is compatible (Public/Public or Organizational/Organizational), or disable the firewall through the "Fast Combine" option.

    The issue is that the firewall can't buffer certain things like functions.

    Let me know if this works or doesn't work for you.

    Tristan

    • Marked as answer by Pau Sempere Tuesday, November 3, 2015 12:54 AM
    Monday, November 2, 2015 10:14 PM
    Moderator

All replies

  • Hi Pau,

    I believe that you're hitting the PQ firewall. In order for this to work, make sure that the privacy level for both data sources is compatible (Public/Public or Organizational/Organizational), or disable the firewall through the "Fast Combine" option.

    The issue is that the firewall can't buffer certain things like functions.

    Let me know if this works or doesn't work for you.

    Tristan

    • Marked as answer by Pau Sempere Tuesday, November 3, 2015 12:54 AM
    Monday, November 2, 2015 10:14 PM
    Moderator
  • Hi Tristan, 

    you were completely right, it was because of the firewall! :) I selected Fast Combine and now is working perfectly. 

    However, the error message is quite misleading, and it does not make sense at all coming from that origin. Something to be totally fixed :( 

    Thank you again.

    Regards.

    Tuesday, November 3, 2015 12:55 AM
  • I'm glad you're unblocked!

    I agree that it's confusing. We could have an error with an informative error message there instead of the text value [Function]. This behavior has been there for a long time. I'll mention your feedback and perhaps we can have a better experience in the future.

    Tuesday, November 3, 2015 2:14 AM
    Moderator