Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hello there!
I am basically looking for the following solution
I have a table with the following columns
Employee number
supervisor number
Regional manager
Only the regional manager fields are completed for the supervisors. However i am trying to take the regional manager value of the supervisor and then complete the blanks for all of the employee names. i have thousands of employees and 100s of managers so need some form of lookup? I am not sure
Solved! Go to Solution.
@TK1966 Please try doing it with powerquery:
You have a table where:
This is clean, performant, and handles the logic correctly even if the hierarchy has multiple levels (as long as regional managers are only filled at the supervisor level).
Steps in Power Query Editor:
Start with your table loaded (let's call the query Employees).
Duplicate the query (right-click → Duplicate) and name the duplicate something like Supervisors or RM_Lookup. → This will be the "lookup table" containing only the rows where Regional manager is known.
In the duplicated query (RM_Lookup), do these clean-up steps:
Now this table contains: supervisor number | Regional manager (only rows where the regional manager is actually filled)
Go back to your main Employees query.
Merge Queries (Home tab → Merge Queries → Merge Queries as New or directly into current):
Expand the new merged column (click the expand icon):
You now have two Regional manager columns:
Combine them with a custom column (Add Column → Custom Column):
if [Regional manager] <> null and [Regional manager] <> "" then [Regional manager] else [Regional manager.1]
Or more concisely (handles nulls better):
if [Regional manager] is null then [Regional manager.1] else [Regional manager]Name it e.g. Final Regional Manager
Remove the two intermediate Regional manager columns if you want.
(Optional) Rename Final Regional Manager → Regional manager
-->It looks up each employee's supervisor number in the list of supervisors → brings back their Regional manager value. This is exactly the "take the regional manager value of the supervisor" logic you described.
You can do it with a single merge by using the same table twice:
Home → Merge Queries → Select your table as both top and bottom → Join supervisor number (left) to Employee number (right) → Left Outer join → Expand only Regional manager from the right side
Then proceed from step 7 above.
I hope this helps. If so please mark it as a solution. Kudos are welcome.
Superb help! Thank you so much!
@TK1966 Please try doing it with powerquery:
You have a table where:
This is clean, performant, and handles the logic correctly even if the hierarchy has multiple levels (as long as regional managers are only filled at the supervisor level).
Steps in Power Query Editor:
Start with your table loaded (let's call the query Employees).
Duplicate the query (right-click → Duplicate) and name the duplicate something like Supervisors or RM_Lookup. → This will be the "lookup table" containing only the rows where Regional manager is known.
In the duplicated query (RM_Lookup), do these clean-up steps:
Now this table contains: supervisor number | Regional manager (only rows where the regional manager is actually filled)
Go back to your main Employees query.
Merge Queries (Home tab → Merge Queries → Merge Queries as New or directly into current):
Expand the new merged column (click the expand icon):
You now have two Regional manager columns:
Combine them with a custom column (Add Column → Custom Column):
if [Regional manager] <> null and [Regional manager] <> "" then [Regional manager] else [Regional manager.1]
Or more concisely (handles nulls better):
if [Regional manager] is null then [Regional manager.1] else [Regional manager]Name it e.g. Final Regional Manager
Remove the two intermediate Regional manager columns if you want.
(Optional) Rename Final Regional Manager → Regional manager
-->It looks up each employee's supervisor number in the list of supervisors → brings back their Regional manager value. This is exactly the "take the regional manager value of the supervisor" logic you described.
You can do it with a single merge by using the same table twice:
Home → Merge Queries → Select your table as both top and bottom → Join supervisor number (left) to Employee number (right) → Left Outer join → Expand only Regional manager from the right side
Then proceed from step 7 above.
I hope this helps. If so please mark it as a solution. Kudos are welcome.
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 6 | |
| 5 |