Forum Discussion

mjoe01's avatar
mjoe01
Regular Visitor
6 years ago
Solved

Using a table to search multiple columns in another table and return a value from the first table

I need to be able to understand which tasks managers need to be aware belong to their team. I would like to use table B which has a list of managers and their team members to identify which tasks in table A the manager has a team member with an action for that task and then return their name in a new column in table A. Teammembers may change over time, which is why I wanted to have table B since it will be easy to update the names in the table. Tasks will usually have just one manager working on it, if there is overlap, as long as one manager is aware of the task it's fine. 

 

Table A      Table B  New Column in Table A
Task IDaction 1action 2action 3  managerteam member Task IDManager Owner
1adambobbob  Davidadam 1David
2bobbobadam  Davidbianca 2David
3bobbiancabob  Davidcharlie 3David
4charliebobbob  Laurendan 4David
5bobbobdan  Timelena 5Lauren
6bobelenabob  Timsarah 6Tim
7sarahsarahbob     7Tim
  • mjoe01 

    Please try this

    Column = 
    VAR A1= LOOKUPVALUE(TableB[manager],TableB[team member],TableA[action 1])
    VAR A2=LOOKUPVALUE(TableB[manager],TableB[team member],TableA[action 2])
    var A3=LOOKUPVALUE(TableB[manager],TableB[team member],TableA[action 3])
    RETURN if(ISBLANK(A1),if(ISBLANK(A2),A3,A2),A1)

2 Replies

  • mjoe01 , Try a new column like

    concatenatex(filter(TableB, TableA[action 1] = TableB[team member] || TableA[action 2] = TableB[team member] || TableA[action 3] = TableB[team member]),TableB[manager])

    or

    concatenatex(summarize(filter(TableB, TableA[action 1] = TableB[team member] || TableA[action 2] = TableB[team member] || TableA[action 3] = TableB[team member]),TableB[manager]),[manager])

  • mjoe01 

    Please try this

    Column = 
    VAR A1= LOOKUPVALUE(TableB[manager],TableB[team member],TableA[action 1])
    VAR A2=LOOKUPVALUE(TableB[manager],TableB[team member],TableA[action 2])
    var A3=LOOKUPVALUE(TableB[manager],TableB[team member],TableA[action 3])
    RETURN if(ISBLANK(A1),if(ISBLANK(A2),A3,A2),A1)