Solved

Crystal report question - running total?  Variable?

Posted on 2007-04-06
7
333 Views
Last Modified: 2010-05-18
Crystal Report 8.5.  I need a report that shows sales data based on customer join date and purchase activity.  Let's say there are 2 tables one containing contact info and the other purchase history joined by contact_id.  I need to show the count of contacts who made purchases within the first year of them becoming a customer, second year, third year etc.  I tried using a running total using and evaluate using a formula that with a datediff calculation and the numbers does not look right.  
0
Comment
Question by:nkuo
  • 4
  • 3
7 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 18864616
Are you looking for the first purchase or do you need all purchases accounted for?
By that i mean if i signed up in July 2004.  Purchases in Oct 2004, Aug 2005, and Dec 2006  
Do you count
   1st year - 1  
   2nd year - 1
   3rd year -1

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18864618
Can you show how you are counting and the results along with sample data?

mlmcc
0
 

Author Comment

by:nkuo
ID: 18865126
only first purchase.  
Sample data would be something like below
contact table
contact_id      Join_date
1      1/1/2004
2      12/23/2005
3      2/29/2007
4      4/2/2006

Order table
order_id      order_date      order_contact_id
1      6/23/2006      1
2      1/21/2007      1
3      12/1/2006      2
4      2/29/2007      3
5      4/5/2006      4

I created an 'purchased within one year'  distinct count running total evaluating
DateDiff ("d", {Contact.Join_Date},Minimum ({Order.Order_Date}, {Contact.Contact_Id}) )  < 365  
would this work?  What is the best way to create the report I want?


0
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

 

Author Comment

by:nkuo
ID: 18865162
report can look something like

      Less than 1year      2 years      after_2year
Total      2                           1       1            
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 125 total points
ID: 18865598
Try this idea

In the report header add a formula
Add a fromula
Name - DeclVars
WhilePrintingRecords;
Global NumberVar Less1Year := 0;
Global NumberVar TwoYear := 0;
Global NumberVar After2Year := 0;

Add a group to the report - group on Contact_ID
Sort the report on SALE DATE

Add a formula to the group header
Name - WaitTime
WhilePrintingRecords;
Global NumberVar Less1Year;
Global NumberVar TwoYear;
Global NumberVar After2Year;
Local NumberVar WaitTime;

WaitTime := Datediff("yyyy",{qry_contact_orders.Join_Date},{qry_contact_orders.order_date});

if WaitTime = 0 then
   Less1Year := Less1Year + 1
else if WaitTime = 1 then
    TwoYear := TwoYear + 1
else
    After2Year := After2Year + 1;
""

Add formulas to the report footer
Name - Disp1Year
WhilePrintingRecords;
Global NumberVar Less1Year;
Less1Year

Name - Disp2Year
WhilePrintingRecords;
Global NumberVar TwoYear;
TwoYear

Name - DispAfter2Year
WhilePrintingRecords;
Global NumberVar After2Year;
After2Year

You can add text or labels as necessary

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18867237
Glad i could help

mlmcc
0
 

Author Comment

by:nkuo
ID: 18867266
Mlmcc. Thank you very much for your help.  
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

13 Experts available now in Live!

Get 1:1 Help Now