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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional subtraction from previous record

Status
Not open for further replies.

GrantReid

Technical User
Jul 24, 2001
5
ZA
Hi

I hope that somebody out there can help with this problem......

I have data which I have grouped by day. The record "WRITES" is a cumalative record, but only accumalates when the following condition is
true; when there is a previous record with a corresponding SPID and KPID.
What I need is.... If there is a previous occurance of the SPID, KPID
combination, then "WRITES" must be subtracted from the previous SPID, KPID
combinations "WRITES". To complicate matters, this must carry over into the
next day. See example below. Is there a formula that will accomplish this?

Group A 1 Jan 2004

SPID KPID WRITES Required Result
------ ------ --------- ----------------
1234 A 2 2
1234 A 4 2
5678 A 10 10
1234 B 7 7
1234 A 16 12

Group A 2 Jan 2004

SPID KPID WRITES Required Result
------ ------ --------- ----------------
5678 B 24 24
5678 A 14 4
1234 B 14 7
1234 A 32 16
1234 A 36 4

Hope someone can shed some light on this.

Many Thanks - Grant
 
I'm not fully clear about what you are doing. Are you using running totals. These include an option to accumulate when a value changes, such as date.

What you seem to be needing is a total for each particular SPID and KPID value for the previous day. If I were doing this, I'd show this explicitly, even when it was zero.

You are trying to stretch Crystal to do something it is really not good at. If you were grouping by date within SPID / KPID, that would be simpleer.

It helps to give your Crystal version, since newer versions have extra options, and some extra problems. I use Crystal 8.5.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top