Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello,
I am very new to make custom functions, but I am running into an error on the following function. I have an Employee table and want to flatten the employee - manager relationship. Before making it recursive, I just tried to make a single join function. I keep getting and error with how I am trying to pass the coumns to the Table.AddJoinColumn() function.
Below is the function and query calling it.
fnFlattenHierarchy
(HierarchyTable, ChildKeyColumn, ParentKeyColumn) =>
let
Source = Table.AddJoinColumn(HierarchyTable,{"ParentKeyColumn"},()=>HierarchyTable,{"ChildKeyColumn"},"NewColumn")
in
Source
Flattened Employee Table
let
Source = fnFlattenHierarchy(Employees, "EmployeeKey", "ParentEmployeeKey")
in
Source
Error
[Expresssion.Error] The Column 'ParentKeyColumn' of the table wasn't found.
Solved! Go to Solution.
ibeleive that putting double quotes around ParentKeyColumn you are having it be treated as a string instead of a variable.
ibeleive that putting double quotes around ParentKeyColumn you are having it be treated as a string instead of a variable.
Well that was easy! Worked like a charm. Hopefully this is an OK approach to making it recursive, thanks for the help!
I have a blog post on recursion with "M". Different problem, but recursion is recursion:
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 38 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 68 | |
| 66 | |
| 29 | |
| 26 | |
| 25 |