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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
A_Vijgo
New Member

Lookup from same table

Hi

 

I am having trouble with looking up for data from the same table. What i am trying to achieve is to capture line manager hierarachy that rolls up to CEO for that particular month (It is a monthly consolidated table). The table looks something like below. In the LM1 column i want to capture who LM ID 2673 reports to (2673 is also an employee and exists under EID column). What could be the best way to approach this? Please help

 

EIDNameLine Manager IDMonthLM 1LM 2LM 3
1036John2673Oct-23   
1178Claire2876Oct-23   
1789Charles2897Oct-23   
1436Sid2567Oct-23   
1098Jackie2345Oct-23   
1236Syed2765Oct-23   
1897Nolan2987Oct-23   
1036John2567Nov-23   
1178Claire2345Nov-23   
1789Charles2765Nov-23   
1436Sid2987Nov-23   
1098Jackie2673Nov-23   
1236Syed2876Nov-23   
1897Nolan2897Nov-23   
1 ACCEPTED SOLUTION

@A_Vijgo 

pls try this

LM1 = MAXX(FILTER('Table','Table'[EID]=EARLIER('Table'[Line Manager ID])),'Table'[Line Manager ID])

LM2 = MAXX(FILTER('Table','Table'[EID]=EARLIER('Table'[LM1])),'Table'[Line Manager ID])

LM3 = MAXX(FILTER('Table','Table'[EID]=EARLIER('Table'[LM2])),'Table'[Line Manager ID])

11.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

10 REPLIES 10
Shailesh2thakur
Frequent Visitor

Relationsip (parent and child) function  like Path and Path length can be used directly here.

Pls refer the link

https://learn.microsoft.com/en-us/dax/parent-and-child-functions-dax 

ryan_mayu
Super User
Super User

@A_Vijgo 

could you pls provide the expected output in the table as well? That will be easier to understand.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi

 

Thanks for the reply. I need, in LM1 column, the Line Manager ID for 2673. 2673 itself is in EID column who has a different Line Manager. and in LM 2 column, the line manager of that line manager.

sorry, still confused about the explaination. In your sample data ,what's the exactly result we should have?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi

 

This is the table, columns LM1, LM2 and LM3 is the result columns i need to capture.

EIDNameLine Manager IDMonthLM 1LM 2LM 3
1036John2673Oct-23256024512981
2673William2560Oct-2324512981 
2560Seth2451Oct-232981  
2451Caroline2981Oct-23   

@A_Vijgo 

pls try this

LM1 = MAXX(FILTER('Table','Table'[EID]=EARLIER('Table'[Line Manager ID])),'Table'[Line Manager ID])

LM2 = MAXX(FILTER('Table','Table'[EID]=EARLIER('Table'[LM1])),'Table'[Line Manager ID])

LM3 = MAXX(FILTER('Table','Table'[EID]=EARLIER('Table'[LM2])),'Table'[Line Manager ID])

11.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi

 

Thanks a ton! Exactly what i wanted, worked perfectly.

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi

 

This seems to work only when there is one month data in it, when i append the next month data it takes the first instance but not for that particular month. For example, when i add the next month's data William could report to someone else and under LM1 for field for next month it needs to capture the line manager for that particular month - How can i tackle that?

pls try to modify the dax

 

LM1 = MAXX(FILTER('Table','Table'[EID]=EARLIER('Table'[Line Manager ID]) && 'Table'[month]=EARLIER('Table'[month])),'Table'[Line Manager ID])

 

apply the change for all the three columns.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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