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!

detect running total reaching goal (CR9)

Status
Not open for further replies.

is8591

Technical User
Dec 18, 2008
2
I am trying to find the date when item sells certain quantity. Table simple like:

Date Item QtySold
9/1/08 A 10
9/1/08 B 8
9/4/08 A 7
... ... ...

I know I have to use Running Total but how should I modify the formula to find exact date when sale goal reached for each item.
 
Insert a group on item and then create a running total {#cumul} of qtysold that resets on change of item #. Then create a formula like this for the detail section and suppress it:

whileprintingrecords;
numbervar curr;
numbervar prev := curr;
curr := {#cumul};
datevar metgoal;
if prev < {table.salegoal} and
curr >= {table.salegoal} then
metgoal := {table.saledate};

Add a reset formula to the group header:
whileprintingrecords;
datevar metgoal;
if not inrepeatedgroupheader then
metgoal := date(0,0,0);

In the group footer, display the date:
whileprintingrecords;
datevar metgoal;

You probably should be posting in forum149 or forum767.

-LB
 
Thank you very much for your help.

As for posting in wrong forum I appologized.
This was kind of an emergency and I did not get a chance to browse other forums. For sure will do in near future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top