Forum Discussion
Look up using date range
- 7 years ago
Hi Anonymous ,
My error forget to change all the names that I used in my example this should do the trick:
Job title = CALCULATE ( FIRSTNONBLANK ( 'Employee Dynamic'[Job Title]; 1 ); FILTER ( ALL ( 'Employee Dynamic' ); 'Employee Dynamic'[EmployeNumber] = 'Travel 2019'[Employee] && 'Employee Dynamic'[Date Start] <= 'Travel 2019'[Date] && 'Employee Dynamic'[Date End] >= 'Travel 2019'[Date] ) ) Budget Group = CALCULATE ( FIRSTNONBLANK ( 'Employee Dynamic'[Budget Group]; 1 ); FILTER ( ALL ( 'Employee Dynamic' ); 'Employee Dynamic'[EmployeNumber] = 'Travel 2019'[Employee] && 'Employee Dynamic'[Date Start] <= 'Travel 2019'[Date] && 'Employee Dynamic'[Date End] >= 'Travel 2019'[Date] ) )Regards,
MFelix
I was afraid that would happen. Basically it's a many to many relatinoship and it can't figure out what to do.
Try this.
IF(
DATESBETWEEN(
'ExpenseTable'[Date],
'EmployeeTable'[Date Start],
'EmployeeTable'[Date End]
),
CALCULATE(
LOOKUPVALUE(
'EmployeeTable'[Job Title],
'EmployeeTable'[EmployeeNumber],
'ExpenseTable'[Employee Number]
)
)
)Why are date start and date end greyed out? Is it because it's the whole column instead of a set date? Same with employee number in the travel sheet.
It keeps giving me errors :smileysad:
-Michael
- jtownsend217 years agoResponsive Resident
Yes, that is correct. I wasn't thinking about that. It needs some agregation, but you can't use one. So that solution wont work.
THe other solution is closer. I think you will need to use a filter expression, but not sure. I am actually heading out for the day, so you will have to post it to the forum, or I can take a look again on Monday.
- Anonymous7 years agoNot applicable
Don't worry about it Jtown I'm going to be out all next week. Going to California for vacation. (Much needed) While I will still work on it for the rest of the day, once it's over I am getting out of here!
-Michael
- MFelix7 years agoSuper User
Hi Anonymous ,
Try adding the following two columns:
Job title = CALCULATE ( FIRSTNONBLANK ( 'Employee Dynamic'[Job Title]; 1 ); FILTER ( ALL ( Budget ); Budget[EmployeNumber] = 'Travel 2019'[Employee] && 'Employee Dynamic'[Date Start] <= 'Travel 2019'[Date] && 'Employee Dynamic'[Date End] >= 'Travel 2019'[Date] ) ) Budget Group = CALCULATE ( FIRSTNONBLANK ( 'Employee Dynamic'[Budget Group]; 1 ); FILTER ( ALL ( Budget ); Budget[EmployeNumber] = 'Travel 2019'[Employee] && 'Employee Dynamic'[Date Start] <= 'Travel 2019'[Date] && 'Employee Dynamic'[Date End] >= 'Travel 2019'[Date] ) )Believe the naming of columns is correct should work as expected.
Regards,
MFelix