Crystal Reports - Difference in a column for 2 records

I am relatively new to Crystal (actually this is the first report I've ever attempted) so please bear with me on this one.

I have a report that is querying employees and also rate information. It has a group so that it only shows the most recent rate information and suppresses the details (the join duplicates employees as many times as their pay has changed and the group forces it down to one row for each employee).

So an employee could have 1 record or have many more depending on how long they've been working. What I want to do is take the last 2 records (if there are 2) and calculate the difference. So for example, if I got hired at 9.00/hr and then got a raise to 10.25 last month, this column should show 1.25. If I got hired at 9.00/hr and have gotten no increase, it should just show either the current pay or 0.00, whichever is easier.

Is this possible?
Who is Participating?
Assuming all the records are there and grouped and sorted appropriately.

You need to
    Group by the Employee ID or Name (suspect it is already there)
    Sort by the effective date descending

Add a formula to the group (employee) header
If  (Not OnLastRecord)  AND  (Next({EmployeeID}) = {EmployeeID})  then
     {Rate} - {Next({Rate})

Open in new window

street9009Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.