SQL Server and CR 8.0 and ODBC

I'm creating a summary executive report for accounts receivable trends. The report is grouped by month (using a date/time field) with the sums based on formulas that are in the detail section (which is hidden).

Report currently looks like this:

Month Sales Cash Balance

Jan XXX XXX XXX

Feb etc...

Mar etc...

I would like to add a column for Sales Two Months Prior and then be able to perform a calculation on that field. So the March line would include the January sales sum. Is there any hope?

I'm creating a summary executive report for accounts receivable trends. The report is grouped by month (using a date/time field) with the sums based on formulas that are in the detail section (which is hidden).

Report currently looks like this:

Month Sales Cash Balance

Jan XXX XXX XXX

Feb etc...

Mar etc...

I would like to add a column for Sales Two Months Prior and then be able to perform a calculation on that field. So the March line would include the January sales sum. Is there any hope?

shared numberVar TwoPrior;

shared numberVar OnePrior;

whileprintingrecords;

if RecordNumber = 2 then

(

OnePrior := Previous({TABLE.NUMBERFIEL

);

if RecordNumber > 2 then

(

TwoPrior := OnePrior;

OnePrior := Previous({TABLE.NUMBERFIEL

);

TwoPrior;

You are correct that previous isn't going to work.

Just curious though what didn't work about my formula? Did you put it in the group footer? I'm just asking because a) I've used it several times before and it works fine for me and b) sounds like the answer to your latest question.

In any event, I'm glad you have it working.

frodoman

Remainder(5,2) = 1 ( 5 divided by 2 leaves a remainder of 1 )

Remainder(72,2) = 0 (72 divided by 2 leaves a remainder of 0 )

The remainder function is commonly used to get even multiples. For example to do something every 14th record you would do a formula: If Remainder(RecordNumber,14)

Hope that makes sense.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.