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?
street9009Asked:
Who is Participating?
 
mlmccCommented:
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
ChangeInRate
WhilePriintingRecords;
If  (Not OnLastRecord)  AND  (Next({EmployeeID}) = {EmployeeID})  then
     {Rate} - {Next({Rate})
Else
     0.00

Open in new window


mlmcc
0
 
street9009Author Commented:
Thanks!
0
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.