cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper IV
Helper IV

Expression.Evaluate code does not work because of unknown identifier

Why does below code not work, and raise an error ("Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?") caused by the Expression.Evaluate part?

 

 

let
    TableA = Excel.CurrentWorkbook(){[Name="tblRoute"]}[Content],
    TableB = Excel.CurrentWorkbook(){[Name="tblBAAM"]}[Content],

    TableA_TableB = Table.AddColumn(TableA, "Outcome", each Table.SelectRows(TableB, Expression.Evaluate("(Magic) => [RouteName]=Magic[RouteName]", [Magic=TableB]))),
    Result = Table.ExpandTableColumn(TableA_TableB, "Outcome", {"Outcome"})

in

    Result

 

 

1 ACCEPTED SOLUTION
Super User III
Super User III

Hi @JVos 

Try

TableA_TableB = Table.AddColumn(TableA, "Outcome", each Table.SelectRows(TableB, Expression.Evaluate("(Magic) => [Name]=Magic[Name]", [ _ = _ ] )))

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

 

View solution in original post

2 REPLIES 2
Helper IV
Helper IV

@AlB Thank you very much! This worked - with a minor change, because the column name is not Name, but RouteName.

 

JVos

Super User III
Super User III

Hi @JVos 

Try

TableA_TableB = Table.AddColumn(TableA, "Outcome", each Table.SelectRows(TableB, Expression.Evaluate("(Magic) => [Name]=Magic[Name]", [ _ = _ ] )))

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

 

View solution in original post

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors