Forum Discussion

A_Vijgo's avatar
A_Vijgo
New Member
2 years ago
Solved

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   
  • 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])

    pls see the attachment below

10 Replies

  • A_Vijgo 

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

    • A_Vijgo's avatar
      A_Vijgo
      New Member

      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.

      • ryan_mayu's avatar
        ryan_mayu
        Super User

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