This field cannot be summarized in crystal report errors - crystal-reports

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.

Right click the report.
Insert.
Summary Fields.
Select the formula you have done on the field and change from max to sum
Change Location to Group Footer
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.

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.

Related

I want to add a group summary data into the formula field in crystal report

I created a account wise group and i want to find the maximum date accroding to the group so i created a summary field. I want to add the summary field in the formula.how can i do that help me.
try this
go to formula workshop and double click Maximum summary field which is most effective way.
go to formula workshop and write as below
Maximum ({Attendance.Date})
The syntax changes if its a group footer I have given it for report footer

Crystal Reports: How to suppress all records in group if ONE based off the value of 1 field

I have a report which lists all employee timesheets (grouped). Each employee will have a record for each day (5 records in total) per group. I want to suppress ALL records for a employee if ANY of the 5 records has a value in a particular field (called "uniqueAttachID").
Basically, if the "uniqueAttachId" is blank, it tells me that the record does not have an attachment and I want to see all employees where this is the case. The attachment can be added to ANY of the 5 records therefore, if ANY of the records HAS data is this field, then I want the whole section of the group suppressed.
You can use below trick to achieve your requirement,
1] create a summary on uniqueattachedID across the group. This summary will give you sum of uniqueattachedID column. Suppress this summary.
2] Now go to the Section Expert of the group. Write formula for Suppress.
3] In formula you will write
if summary column (select this from reports field) > 0 then true
else false
I hope this helps!
If you want to suppress ALL records (Group and Detail), you will have to go into Section Expert, and in the suppress formula for each section of your report that you want to suppress, you enter
uniqueAttachID <> ""
That will suppress each section if uniqueAttachID has a value. You may need to adjust the formula if uniqueAttachID is a numeric field.

Display records side by side

I use a DataTable to bind my crystal report. It contains columns for credit and debit. If either one is zero, so is the other. Therefore every column contains either credit or debit information. I want to display something like:
Bank Name(Credit)|CreditAmt|BankName(Debit)|DebitAmt
My first column needs to display credit records with the bank name, and the second column displays Credit Amount and same logic for Debit amount - which displays in 3rd and 4th column.
My output currently looks like:
HDFC Bank | 550 |(blank) | 0
blank) | 0 | 500 | HDFc bank
I get blank a space and 0 in any section either credit or debit - because I only get the credit or debit amount per record. Therefore it puts 0 and blank spaces for other sections. How can I suppress th blank section to look like the following?
HDFC Bank | 550 |(blank) | 500 |HDFc bank
What you need to do is summarize your transactions by a common column to both your Debit and Credit. I assume Bank Name is the common link. Then summarize your Debit and Credit. Here are the steps to take:
Menu Insert->Group (Select the column common to your Dr. and Cr.)
Menu Insert->Summary (Select your Dr. Column and use SUM)
Place the results on the Group Header line
Menu Insert->Summary (Select your Cr. Column and use SUM)
Place the results on the Group Header line
Hide your details line
Now to further your understanding of what we are doing here, suppose you wanted to summarize by the accounts per bank. You'd do step 1, then insert another group by Account and then add the summarized Dr. & Cr. to the Account Group Header.
Cheers.
Grouping solution is great.
Another possible solution is:
- creating a formula field called NextDebit that gets Debit value from the next line Next(Debit)
- show in Detail Section Credit and NextDebit
- suppress details where Credit = 0
Another solution i working on the query, so that you'll have just the data you need in the way you need to work on.

Formula for Suppressing Field if duplicate in Crystal Reports

I have a view which shows data on crystal reports where I have fields like tariff,rental,shares,gross and net.My problem is if someone changes the tariff in database it would show 2 rows of the same record with different tariff which is normal behavior from database point of view but I want to suppress the field of monthly rental to 0 if the same id has different tariff or the rental is repeated in new record.
ID Tariff Rental
1 20 390
1 15 390
I want the field of Rental on reports to be suppressed if duplicates based on id.Currently I have used this formula in crystal report to check previous field data and suppress if duplicate.
{DatabaseField}=Previous({DatabaseField})
It is working fine but if the id is not same and the rental is repeated then also it will suppress which I don't want.I want it to suppress only for same id.
You have to write the formula into field suppress. (No need on suppress if duplicated)
On Rental Field
{ID} = previous({ID}) and {rental} = previous({rental})
If ID and Rental are same then only the Report will suppress Rental.
I guess this will work for you.
In Crystal Reports, right-click on the Details section and select Section Expert.
In the Section Expert dialog box, select the X + 2 button beside the Suppress command. The check box must remain unselected for this formula to work.
In the Formula Editor dialog box, create a conditional formula containing the Next function to evaluate the records for duplicate values and to suppress the Details line
example:
{Table.Databasefield}=Previous({Table.Databasefield})
I had to make a slight change to the formula in the solution by Janarthanan by adding parenthesis to make it work with Crystal XI.
I used:
{ID}=previous({ID}) and {rental}=previous({rental})
this formatting variation, which is presented in the edited question, helped me to solve a similar problem.
Put this in suppress formula of field to hide.
if {myTable.ID} = previous({myTable.ID}) then
true
else
false

Conditional group SUM in Crystal Reports

I've been doing some accounting reports and have been summing up my different currencies using a formula
IE
CanadianCommissionFormula
if {myData;1.CurrencyType} = "CDN" then
{myData;1.Commission}
else
0
CanadianCommissionSum
SUM({#CanadianCommissionFormula})
Then I'd just display the CanadianCommissionSum at the bottom of the report and things were great.
I've just come across the requirement to do this, but grouped by Sales Rep. I tried using my previous formula, but this sums for the whole report. Is there an easy way to sum like this, based on which group it's in?
You probably figured this out a year ago, but just in case, try this:
Change your CanadianCommissionSum formula to
SUM({#CanadianCommissionFormula},{SalesRep})
Put this formula in your SalesRep's Group Footer section.
This should now display properly.
Create a group based on the sales rep in the Crystal Report, and place the:
SUM({#CanadianCommissionFormula})
...in the footer of the group.
I would assume that rexem's suggestion should work but since you said it gives you a total all of the sales reps you could change the sum to running total. Before doing this I'd double check that you have your field in the correct footer section though.
To do the running total, group by Sales Rep, and then set up your running total to evaluate on every record and reset on the change of the group. Then you can put this running total in the group footer and it will show subtotals.
Hope this helps.