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!

3 Month Rolling

Status
Not open for further replies.

Doni85

Programmer
Feb 20, 2014
1
ZA


ID Employees Month
1 6 Nov 2013
2 3 Dec 2013
3 4 Jan 2014 formula result = 13
4 5 Feb 2014 formula result = 12

I need the Sum of all 3 monthly employees. Thus, on line three, in this example, I would need the total of 13 as indicated as that piece to place in the formula. I would need this to continue calculating in three month intervals all the way through. For example, in line 4, the numbers of which are not depicted here, I would have the sum of lines 2,3, and 4 = 12.

I saw this on a previous thread but it's only giving me 0 after I re-wrote the formula for my report.

Please help.
 
Try the following approach.

1. Create a formula called {@NULL} and save it without entering any code;

2. Create the following formula, which will add the current {Table.Employees} plus 2 previous {Table.Employees}:

Code:
WhilePrintingRecords;

Global NumberVar s1; 
Global NumberVar s2; 
Global NumberVar s3; 
Global NumberVar S;

s3 := s2;
s2 := s1;
s1 := {Table.Employees};

If      RecordNumber >= 3 
Then    S := s1 + s2 + s3
Else    Val({@NULL})

Hope this helps.

Cheers
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top