Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rdwd15
New Member

How to createtable from one table but filtering based on values from another table

Hello Friendly Helpers,

I have been racking my brain and the interwebs and the youtubes for this.  I am former DB dev, and i could so this faily easily in SQL, but alas I am using the tools available to me.  So I have a table with the following data:

 

This table has all employees in it with the id of the employee they report to.

AllEmployees
EmployeeIDEmployeeNameManagerID
1A99
2B1
3C1
4D2
5E2
6F3
7G3
8H9
9I9
10J9

 

I created a table that where the managerID = 1 from the AllEmployees table. 

Level1Managers
EmployeeIDEmployeeNameManagerID
2B1
3C1

 

 

On this table, i would like to create a table that is populated with employees that have the ManagerID that is in Level1Managers.

Level2Managers
EmployeeIDEmployeeNameManagerID
4D2
5E2
6F3
7G3

 

So essentially i am planning on creating an org hierarchy out of this, going many many times over until it is complete.

 

For now, i would like to create the 3rd table.  I have been using createtable, but i am not sure how to put a list of dynamic values in the validation portion of the expression.

I tried:

LevelTwoManagers = CALCULATETABLE('All',LevelOneManagers[manager] = <this is where i get stuck>

Essentially i want to bring back the all the values from the AllEmployees table where ManagerID = LevelOneManagers.EmployeeID
 
HELP!!!!!  I am sure it is so very easy, but I just can't figure it out.  I have used things like instersect, and filter and i just can't seem to find what i am looking for.
2 ACCEPTED SOLUTIONS
jsaunders_zero9
Responsive Resident
Responsive Resident

Hi @rdwd15,

Have you considered using PATH as a basis to build your org heirachy?

 

 

Heirachy = PATH(Employee[EmployeeID],Employee[ManagerID])

 

jsaunders_zero9_0-1651099188704.png

Let me know if that helps

View solution in original post

To further expand on the above, splitting it can be done using PATHITEM (Index from left) or PATHITEMREVERSE (Index from right).

Manager 1 = PATHITEMREVERSE(Employee[Heirachy],2)
Manager 2 = PATHITEMREVERSE(Employee[Heirachy],3)
Manager 3 = PATHITEMREVERSE(Employee[Heirachy],4)

jsaunders_zero9_0-1651099690389.png

 

View solution in original post

6 REPLIES 6
rdwd15
New Member

Thanks, that totally looks like what I want to do but with so many fewer complicated steps. 

I will give this a try. 

Good to hear @rdwd15, be sure to check back to let me know how you went.

Hello J.  Thanks so much, yes this will work exactly how i want it to, and so much easier than my long conviluted way i was going about it.

 

Thanks again.

Glad I could help and save you some time 👍

jsaunders_zero9
Responsive Resident
Responsive Resident

Hi @rdwd15,

Have you considered using PATH as a basis to build your org heirachy?

 

 

Heirachy = PATH(Employee[EmployeeID],Employee[ManagerID])

 

jsaunders_zero9_0-1651099188704.png

Let me know if that helps

To further expand on the above, splitting it can be done using PATHITEM (Index from left) or PATHITEMREVERSE (Index from right).

Manager 1 = PATHITEMREVERSE(Employee[Heirachy],2)
Manager 2 = PATHITEMREVERSE(Employee[Heirachy],3)
Manager 3 = PATHITEMREVERSE(Employee[Heirachy],4)

jsaunders_zero9_0-1651099690389.png

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.