Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find closest date

Status
Not open for further replies.

Mark.rooker

Technical User
Apr 29, 2020
2
GB
Morning

My 1st post on here, so please be kind!

I am trying to find a way of pulling in data based on matching the closest lower date.

I have 2 tables:

Employee_Bookings that holds all the Time & Attendance of our employees and includes the following columns:
Emp_No
Date
Time_in
Time_out

Effective_Rate that includes the employee rates of pay and when that became effective and includes the follwoing columns:
Emp_No
Eff_Date
Rate

What I am trying to do is get the employees rate of pay at Employee_Bookings.Date by finding the closest lower Effective_Rate.Eff_Date

I hope that makes sense and someone will be able to point me in the correct direction


 
You could use a >= join FROM the Employee Bookings table TO the Effective Rate table on Date to Eff_Date, with an equal join on the Emp_no field. This will return potentially multiple eff_dates per employee. Insert a group on {Employee Bookings.Emp_No}.

Then go to report->selection formula->Group and enter:

{Effective_Date.Eff_Date}}=maximum({Effective_Date.Eff_Date},{Employee_Bookings.Emp.No})

This will return only the row containing the most recent rate.

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top