Forum Discussion

rachaelwalker's avatar
rachaelwalker
Icon for Resolver III rankResolver III
2 years ago
Solved

Lookup value based on multiple conditions from another table

I have two tables that are related many-to-many. They are related by Job Number. Field Rework and Time Entries. From the Field Rework table, I would like to lookup the sum of hours in the Time Entries table based on when the dates are the same and who the technician was

 

Field Rework

Job NumberDateHours Reported
11873/20/2024       16
60773/28/2024        8
11112/29/2024        4
60163/1/2024         3

 

Time Entries

Job NumberDate EnteredTechnicianHours Worked
60773/30/2024Bobby         8
60773/29/2024Bobby         9
60773/28/2024Bobby         8
60773/27/2024Bobby         8
60163/1/2024Larry         3
60162/22/2024Larry        4.5
60162/16/2024Larry         5
60162/7/2024Sam       4.5
60778/4/2016Brad       1.5
60776/3/2016Brad       1.5

 

Expected Results

Job NumberDateHours ReportedTechnicianHours Worked
11873/20/202416  
60773/28/20248Bobby      8
11112/29/20244  
60163/1/20243Larry       3

 

In some cases there are multiple technicians so there will be multiple entries by different techs, so I have a measure to list them in a string using CONCATENATEX which is working great; however is there a way to include the hours completed by each in parentheses? "Bobby (8), Sam (2)"

 

 

 

 

 

Technician List = CONCATENATEX(VALUES('Time Entries'[Technician]),[Technician],", ")

 

 

 

 

 

Example: 

Job NumberDateHours ReportedTechnicianHours Worked
60773/28/20248Bobby (8), Sam (2)        10



3 Replies

  • Hi rachaelwalker 

     

    How about using multiple search conditions using LOOKUP formula : 

    LOOKUPVALUE (
    <result_columnName>,
    <search_columnName>,
    <search_value>
    [, <search2_columnName>, <search2_value>]…
    [, <alternateResult>]
    )

    • rachaelwalker's avatar
      rachaelwalker
      Icon for Resolver III rankResolver III

      I cannot get lookupvalue to work. It says it cannot see my column in the Time Entries table. I used a similar measure but it is returning the sum of all hours and not the sum for just that date. I understand what it is doing and why I am getting the results but I dont know what to change to make it work the way I need it to

      Hours Worked Look UP = 
      CALCULATE(
          SUM('Time Entries'[Hours Worked]),
          FILTER(
              ALLNOBLANKROW('Field Rework and Delay Tracker'[Date]),
              'Field Rework and Delay Tracker'[Date] = MAX('Time Entries'[Date Entered]) 
          )
      )