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

Previous Function

Status
Not open for further replies.

rpmel

Technical User
Jan 8, 2009
9
I've created a report to calculate suggested stock holding:

Using the following example:

Part Number ABC123
Leadtime (Days) = 5
Buffer Stock (Days) = 2
Sales per Day = 1

Formula Field setup as follows:

Sales x Leadtime + Bufferstock (1 x 5 + 2 = 7)

I'm getting 29!!! Here's why: My report is grouped on Part Number and a SUM setup in the group footer. The formula is adding the Buffer stock in for EACH detail line - I only want to add it once!

I came up with the following:

Code:
If Previous ({ICSTATI.ITEMNO}) <> {ICSTATI.ITEMNO} Then
({@SLSWK} / 5)  * ({?Leadtime})  + ({?Buffer Stock (Days)}) Else
({@SLSWK} / 5)  * ({?Leadtime})

But of course, the SUM function doesn't work because of the order in which Crystal processes things.....I think I need to use variables? Not really sure how to do this one?

Any thoughts?
 
YOu could use a Running Total, and get it to evaluate only on change of what ever detail is causing the duplications.

Ian
 
Create a formula {@salesxleadtime}:

({@SLSWK} / 5) * {?Leadtime}

Then create a second formula for the group footer:

sum({@salesxleadtime},{table.ptno})+ {?Buffer Stock (Days)}

-LB
 
Thanks lbass - works a treat ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top