Forum Discussion

Nolock's avatar
Nolock
Resident Rockstar
7 years ago
Solved

Expression.Evaluate(_, #shared) in PowerBI Service

Hello,

I'm searching for an explanation of the following problem:

 

I'm developing a lot of PowerQuery queries and recently, I had to use Expression.Evaluate:

 

Expression.Evaluate("my expression using the internal function Text.Upper ", #shared)

It works in Power BI Desktop. When I publish my dataset to PBI Service (Premium) and let it refresh, the following error comes:

 

Does anybody have an idea why it doesn't work?

 

Actually, I have a workaround for my current case, but it is not a general solution:

Expression.Evaluate("my expression using the internal function Text.Upper ", [Text.Upper = Text.Upper])

EDIT: Or if you need a list of all Text.* function names in PowerQuery, you can create it manually in advanced and use it as a record for the new scope:

let
    Shared = #shared,
    TextFunctionNames = List.Select(Record.FieldNames(Shared), each Text.StartsWith(_, "Text.")),
    Result = List.Transform(TextFunctionNames, each _ & " = " & _ & ",")
in
    Result

Thank you very much for an explanation or a hint in advanced.

Best regards,

Nolock 

 

4 Replies