zahid mahmood
zahid mahmood

Reputation: 71

This field cannot be summarized in crystal report errors

I was be able to output a crystal report and this is about accounting logic.

some of the column appear in my crystal report is eg.

accountname debit credit


cash..........1000...300

I want the column debit minus column credit (1000-300) if the result is positive (+) then 700 will appear in that debit column If the result is negative (-) then the value appear in credit column and i wan to remove the negative sign. So above value 1000 and 300 is not what i wan to show and debit or credit will be 0 eg

accountname debit credit


cash...........700......0

Above case is ok so far and now i end up like this In crystal report formula editor i have @creditbalance, and inside it has formula:

if Sum ({Entries.Debit}, {Entries.AccountName})>Sum ({Entries.Credit}, {Entries.AccountName}) then formula= Sum ({Entries.Debit}, {Entries.AccountName})-Sum ({Entries.Credit}, {Entries.AccountName}) end if

So it can give me as i wanted to show (the 700 and 0 part) The problem is i create another formula @TotalDebitBalance

Sum ({@DebitBalance})

It error said "This field cannot be summarized", Then how to sum up the value i get from @debitBalance.

Note: @TotalDebitBalance i plan to put it at report footer section where all grant total usually placed there, where @debitbalance i put it at Group Header section.

Upvotes: 0

Views: 13064

Answers (2)

ca_wan
ca_wan

Reputation: 321

It doesn't say but I'm assuming the report is grouped by {Entries.AccountName}. In addition to Waqar's solution, I'd replace the formula with something easier.

{@DebitBalance}
IF {Entries.Debit} > {Entries.Credit} THEN
   {Entries.Debit} - {Entries.Credit}
ELSE
   0

{@CreditBalance}
IF {Entries.Debit} < {Entries.Credit} THEN
   ABS({Entries.Debit} - {Entries.Credit})
ELSE
   0

In the details section, replace the {Entries.Debit} and {Entries.Credit} with {@DebitBalance} and {@CreditBalance} repectively. This will give you the

cash...........700......0

Then do as Waqar mentioned to summarize the formula. It's easier to use the Group... and Summary... features than to do it manually in the formulas.

Upvotes: 0

Waqar
Waqar

Reputation: 226

  1. Right click the report.
  2. Insert.
  3. Summary Fields.
  4. Select the formula you have done on the field and change from max to sum
  5. Change Location to Group Footer
  6. Do the same again and this time select the Report Footer

You will have two fields, one for the group footer and other for report footer, hope this helps.

Upvotes: 1

Related Questions