I am trying to build a Power Query function that will return a value from a table looked up based on an input parameter. Eg.
Table:
Name Team
George Server
June DBA
Now I want to supply Name to the function and return the position. Source table is a table defined in the same Excel workbook. I started with that but not sure where I am failing:
(EmployeeName as text) =>
let
Source = Excel.CurrentWorkbook(){[Name="Employees"]}[Content],
EmployeeRow = Table.SelectRows(Source, each ([Name] = EmployeeName)),
Result = Record.Field(EmployeeRow, [Team])
in
Result