Solved

Creating totals in Crystal Reports 2008

Posted on 2011-09-26
10
204 Views
Last Modified: 2012-05-12
I created an outstanding invoices report in Crystal Reports 2008.  The data is pulled from an Access database.

I have a formula that calculates the remaining amount for each OPEN contract.  In order for that formula to work I had to have all invoices included in the report.  Then I used if then else statements to make it so that  the entire row would be "blank" for each invoice that has been paid.  I then used the Section Expert (by right clicking on Details in design view) to "Suppress Blank Sections."

The report is now how I want it except for TOTALS.  

I want a grand total for remaining amounts and a grand total for unpaid invoices.

I cannot use a "summary" to sum either of them up because of how the report was created.

Is there another way for me to total these two columns?  If so, how?




Thank you in advance for your time.
0
Comment
Question by:meshoxford
  • 5
  • 4
10 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 36600877
Not sure why you can't use a summary provided you get the data set correctly.

A formula like

If (HidingFormula) then
   0
Else
   {Amount Field}

You should be able to summarize that to get the value.

If not the please upload the report.

mlmcc
0
 
LVL 1

Expert Comment

by:Hlanai
ID: 36908722
Don't pull the fully paid invoiced to the report so that you can suppress the lines. Filter out the fully paid invoices in the record selection so that none of the fully paid invoices appear on the report, whether suppressed or not. Once you do this, then you can do a simple some of those amounts.

It is that straight forward, unless I misundetstood your question.
0
 

Author Comment

by:meshoxford
ID: 36932711
Hlanai:

I originally used record select to show only unpaid invoices.  The formula to calculate the remaining amounts per contract looked something like this:
{table1.originalAmount} - Sum({table2.invoiceAmount}, {table1.contractNumber})
CR only summed the invoices that were in the report, then.
Also, using record select made it so that only contracts with unpaid invoices showed up in the report.  I need remaining amounts for all open contracts whether there are unpaid invoices or not.  
This is why I created the report the way I did.




mlmcc:

As far as getting the data set correctly, I returned blank strings for all data fields relating to each paid invoice so that I could suppress those sections.
The two reason I even have the paid invoices in the report is so that
(1)  I could calculate the remaining amounts for each contract and
(2)  All open contracts and their remaining amounts showed up.
Like I said that made it so that my report showed exactly what I wanted.  So to clarify, the report is essentially outstanding invoices AND amounts remaining.

When I select Insert - Summary and then select unpaidInvoices from the drop down menu, the options in the next drop down of how to summarize the options are Maximum, Minimum, Count, etc.  BUT Sum, Average, Median, etc. are not included.  I am assuming that this is because I am returning a blank string (as explained above).

If you could clarify where you would put this:
If (HidingFormula) then
   0
Else
   {Amount Field}
then I will be able to let you know if it will work.




Both:

I hope I didn't confuse you even more.  This should hopefully break it down:

Please let me know if you know a better way to filter, hide, or suppress the paid invoices in a way where I will be able to:
(1)  Show the remaining amounts for each open contract whether the contract has unpaid invoices at the time or not.
AND
(2)  Calculate these remaining amounts CORRECTLY.
AND
(3)  Summarize the unpaid invoices as a grand total in the footer.




p.s. I would like to summarize the remaining amounts as a grand total in the footer too, but when I go to Insert - Summary, the pull down menu does not include my report field amountRemaining.  I am assuming this is because there is a Sum in the formula for the field.  This is one item I would like to have in the report but it will not make or brake it.  Please let me know if you have any ideas as to why it will not let me summarize that field.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 36934572
If (HidingFormula) then
   0
Else
   {Amount Field}


I would put it in the detail section then summarize it.  Once you have the summary you don't need it in the report

To get a grand total of a summary just copy the summary and put it in the report footer.

mlmcc
0
 

Author Comment

by:meshoxford
ID: 36950007
mlmcc:

I see what you mean now.  That is so simple I cannot believe I didn't think of it myself.  It worked perfectly for the invoices, but I still can't get the remaining amounts to total.  Do you have any suggestions for that?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36950222
Is the remaining amount a field in the database?

mlmcc
0
 

Author Comment

by:meshoxford
ID: 36950363
mlmcc:

No.  It is a field in my report.  The formula looks something like this:

{Table1.originalAmount} - Sum ({Table2.invoiceAmount}, {Table1.contractTitle})

If it were a field in the database then my report would have been much simpler.  It is actually a query in the database.  
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36950596
Try this idea for the grand total

Sum({Table1.originalAmount}) - Sum ({Table2.invoiceAmount})

mlmcc
0
 

Author Comment

by:meshoxford
ID: 36951005
mlmcc:

I tried that earlier!  There must be a lot of incorrect numbers from years ago so the total does not come out right.

Thank you for all of your help.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36952391
If you have bad data then you really can't do much in the report unless you can determine it is a bad record and ignore it.

mlmcc
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question