Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Lookup value with two variables - need help

Hi!   I have an issue with with report I'm building for my company. I have a two tables that I want to combine. One with Salary listed per employee and another table with worked hours. Salaries for...
  • LaurentCouartou's avatar
    8 years ago

    Looking for something like this? (assuming HoursWorked and Salary are both related to Employees).

     

    =VAR dt = HoursWorked[Date]
    RETURN CALCULATE( 
           VALUES(Salary[Salary])
        	,Salary[FromDate] <= dt
        	,Salary[ToDate] > dt || Salary[ToDate] = BLANK()    
        	,ALLEXCEPT( HoursWorked, Employee[EmployeeID] )
     )

    Note, the expression will return an error if more than one salary is found for a given employee at any time.