Hi all,
I'm new in crystal report and I've created a report and get a set of data.
I want to add a new value in each line which can sum all the last 12 line at the top of itself. (such as select sum in running total field but only sum last 12 records)
I tried to use the running total field but have no idea about how to setup the reset formula
pls help
thanks
Regards,
KinCan be done with a manual running total. But you need to store 12 previous values to memory variables and rotate them manually, to be able to subtract the last value in queue and add the current value. A bit of code to write but it should work.|||Can be done with a manual running total. But you need to store 12 previous values to memory variables and rotate them manually, to be able to subtract the last value in queue and add the current value. A bit of code to write but it should work.
Hi wapper,
Any example or reference website about how to do it?
Sorry, I m new in crystal report..
Regards,
Kin|||http://support.businessobjects.com/library/kbase/articles/c2006365.asp
You might want to search the knowledge base for more information on "manual running total".
Manual running totals give you control on HOW the summary is evaluated. Ordinary running totals only allow you to choose WHEN to evaluate.|||Thanks|||I tried to create the followings.
the value
Sum ({@.totalResignTurnover}, {X.EFFDT}, "monthly")
is the variable (which grouped by month in crystal report) which I need to sum, my problem is I need to sum up the last 12 months where the variable is grouped by another date (X.effdt)
How to group the last 12 months.. (I can get the variable but don't know how to get the past 12 months.
Sorry for question about this again.
pls help.
thanks
Dim i as number
dim total as number
total = 0
for i = 1 to 12
total = total + Sum ({@.totalResignTurnover}, {X.EFFDT}, "monthly")
next i
formula = total|||Someone else was trying to do something similar recently. I take no credit for this solution ;)
The key here is to constantly track the previous 12 months and calculate the current month.
// formula {@.Last12months} - place this formula in your "month" group footer. The '...' bits are for you to fill in!
WhilePrintingRecords;
NumberVar mth1;
NumberVar mth2;
...
NumberVar mth12;
NumberVar All12months;
mth1:= mth2;
mth2:= mth3;
...
mth11:= mth12;
mth12:= Sum ({@.totalResignTurnover}, {X.EFFDT}, "monthly");
All12months:= mth1 + mth2 + mth3 + ... + mth12;
I guess you can then create another formula to return the All12months value and put it where you want it, i.e.
// formula {@.All12months}
WhilePrintingRecords;
numbervar All12months|||it works.
thanks
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment