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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
street9009Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.