Print Page | Close Window

Formula that references Max and Min summary values

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19983
Printed Date: 02 May 2024 at 9:30pm


Topic: Formula that references Max and Min summary values
Posted By: rmdalrk
Subject: Formula that references Max and Min summary values
Date Posted: 04 Sep 2013 at 11:51am
I have a formula called Average Days that displays the average number of days between invoices.  Here is the formula:

{@DateDiff Spread}/Count ({ARFID.INVOICE_NUMBER}, {ARFID.CUST_PART_ID})

Here is the DateDiff Spread formula referenced above:

(Maximum ({ARFIM.INVOICE_DATE}, {ARFID.CUST_PART_ID})-Minimum ({ARFIM.INVOICE_DATE}, {ARFID.CUST_PART_ID}))+{@Current Date - Max}

The Average Days formula is working and displaying the correct values.  However, I need to be able to use its results as part of an aglorithm formula that assigns weights to other values then displays 1 final value.

When I reference the Average Days formula in another formula, I get an error:

"A summary has been specified on a non-recurring field.
Details: @Sales Sum"

Sales Sum is the formula that should display the final value.  I think the issue is that I'm trying to reference a formula that references Maximum and Minimum summary values, but I'm not sure how to work around this.

Any help would be great.



Replies:
Posted By: DBlank
Date Posted: 05 Sep 2013 at 4:48am
try using shared variable formulas to get your other values


Posted By: rmdalrk
Date Posted: 05 Sep 2013 at 10:48am
Thank you for the reply.

I haven't worked with variables much, but here is what I tried with no success.

I edited the Average Days formula to:

whileprintingrecords;

Shared NumberVar avgdays := {@DateDiff Spread}/Count ({ARFID.INVOICE_NUMBER}, {ARFID.CUST_PART_ID});

I then created a new formula called AvgDaysVariable and called the variable:

Shared NumberVar avgdays;

The variable value displays correctly but I'm still unable to use the variable value in another formula.

I tried using the variable in this formula:

({@QTY Previous 30 Days}*10)+{@QTY Previous Year}*1.5 + shared numbervar avgdays

I also tried calling the other formula field:

({@QTY Previous 30 Days}*10)+{@QTY Previous Year}*1.5 + {@AvgDaysVariable}

Either way, I'm still getting the same error.



Posted By: kostya1122
Date Posted: 09 Sep 2013 at 7:39am
are you able to use SQL?


Posted By: rmdalrk
Date Posted: 09 Sep 2013 at 7:55am
I don't have much experience with SQL.


Posted By: kostya1122
Date Posted: 09 Sep 2013 at 8:16am
well my idea was to create a command
your main select which you could look up in
database tab >> show sql query
past that query and i'll see if i can help you






Print Page | Close Window