Solved

Crystal Reports formula issue

Posted on 2014-11-19
3
157 Views
Last Modified: 2014-11-20
I am trying to create a summary that only looks at the past months data.  The query pulls the past 6 months, but I only have a summary for the past month.   I am using a case statement as below...

select (Month({Ens_CustDashReport;1.order_date}))
      case  Month(CurrentDate - 1):
    ((Sum({Ens_CustDashReport;1.On Time shipment})/count({Ens_CustDashReport;1.co_line})) * 100)

   Default : 20

This doesn't work it always looks at the entire collection.  Can anyone help?
0
Comment
Question by:spoye
3 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 40453811
Try a formula like
Name - LastMonthShipped
If ({Ens_CustDashReport;1.order_date} In LastFullMonth then
     {Ens_CustDashReport;1.On Time shipment}
Else
    0

Open in new window


Add another formula
Name - LastMonthCount
If ({Ens_CustDashReport;1.order_date} In LastFullMonth then
    1
Else
    0

Open in new window


Summarize with
Sum(LastMonthShipped) / Sum(LastMonthCount) * 100

Open in new window


mlmcc
0
 
LVL 34

Expert Comment

by:James0628
ID: 40454727
The problem is that CR summary funtions (Sum, Count, etc.) always give you the total for the entire report (or group).  It's not conditional.  For example, if you have a formula like this:

if {field1} = "Y" then
  Sum ({field2})

 Whenever field1 is "Y", you'd get the total for field2 for the entire report.  If field1 is not "Y", you'd get 0.

 You can use formulas like the ones that mlmcc posted to control which records are included in a summary, although the last formula should be:

Sum({@LastMonthShipped}) / Sum({@LastMonthCount}) * 100


 FWIW, I'd probably use formulas like those, but, if you don't need the summaries until the end of the report, running totals would be another option.  You would set the summary and count to be evaluated when the date was in the desired month.

 James
0
 

Author Closing Comment

by:spoye
ID: 40455148
I worked! Thank you very much for the help, and for helping me to learn a bit more.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now