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
JVos
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
AlB
Super User
Super User

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
JVos
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

AlB
Super User
Super User

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

 

 

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