Crystal Report: Customer Sales History - Multiple Years, Different Periods

OK, friends!  If either of you can solve this for me, you will be my hero for month! Lol

I have created a custom report that is sorted by Customer Number. Main tables involved are AR_Customer and AR_CustomerSalesHistory.  I need for this ONE report to display the following:

1. Customer # and Name

2. Dollars Sold for Period 11 and 12, 2016 (totaled)

3. Dollars Sold for Period 1 to Date, 2017 (totaled)

4. Grand Total of Dollars Sold (combined) for #2 and #3.

This report would be a running total of Dollars Sold, basically, for Sales History from 11/1/2016 to Present, based on a specific Customer Type. If this is even possible, and you can provide instruction on how to accomplish this, it would be GREATLY appreciated! :)

- T. Helm

  • 0
    Add formulas:
    YearPeriod: {AR_CustomerSalesHistory.FiscalYear} & {AR_CustomerSalesHistory.FiscalPeriod}
    Period1: if {@YearPeriod} in ["201611","201612"] then {AR_CustomerSalesHistory.DollarsSold} else 0
    Period2: if {@YearPeriod} in ["201611","201612"] then 0 else {AR_CustomerSalesHistory.DollarsSold}

    Record selection formula: {@YearPeriod} >= "201611"

    Period1 gives you #2 and Period2 gives you #3
    For #4 you can simply use DollarsSold, or sum Period1 and Period2.

    The rest should be easy:
    Subtotal by customer and add a grand total for each column.
    Suppress Details and Group Header #1, add CustomerName to Group Footer #1
  • 0 in reply to 49153
    Thanks so much. Ok... I added the formulas, but I don't see Year 2017 anywhere in the mix? I need for it to have a grand total of Periods 11 + 12 for 2016, ADDED to Period to Date 2017. Hope that makes sense. Also, am I "grouping" by Customer #?

    T. Helm
  • 0 in reply to helmt01
    Further...and as an example. We had a customer with sales for Period 11 & 12 (2016) combined totaling $36,110.24. For Period 1 (2017) to Date, they had sales of $18,556.70. Therefore, their total sales for Period 11 & 12 (2016 plus Period 1 (2017) to Date should be $54,666.94 as Dollars Sold. Currently, with the formulas you provided, that total is only showing as $10,500.39...which is the total for Period 1, 2017 only.
  • 0 in reply to helmt01
    The formula for Period2 gives you 2017 YTD.
    Yes you are grouping by customer.
  • 0 in reply to helmt01
    You're confusing me.... you are contradicting what you asked for in your first post.
  • 0 in reply to helmt01
    As a test add 3 formulas:
    if {@YearPeriod} = "201611" then {AR_CustomerSalesHistory.DollarsSold} else 0
    if {@YearPeriod} = "201612" then {AR_CustomerSalesHistory.DollarsSold} else 0
    if {@YearPeriod} = "201701" then {AR_CustomerSalesHistory.DollarsSold} else 0

    See what they kick out and if you agree. They will give you sales for 2016-11, 2016-12 and 2017-01 respectively.
  • 0 in reply to 49153

    Sorry, I don't mean to sound confusing. Thanks for your help. All I can tell you is...I created the formulas as you instructed just like this:

    YearPeriod:  {AR_CustomerSalesHistory.FiscalYear} & {AR_CustomerSalesHistory.FiscalPeriod}

    Period 1: if {@YearPeriod} in ["201611","201612"] then {AR_CustomerSalesHistory.DollarsSold} else 0

    Period 2: if {@YearPeriod} in ["201611","201612"] then 0 else {AR_CustomerSalesHistory.DollarsSold}

    Record Selection:  {@YearPeriod} >= "201611"

    Here is a screenshot of the actual report...AFTER adding/modifying same as you instructed:

    What am I missing?  Again, the total for that customer I mentioned previously SHOULD be larger than what the report is displaying. When I look at total sales for Period 11 & 12, 2016 and Period 1 to Date, 2017, it's not the same total. Thanks!

  • 0 in reply to helmt01
    I don't have your data so I cannot give you insight.
    Go back to my previous reply and try the 3 formulas and see what you get.
  • 0 in reply to 49153
    I understand - no worries. Ok, adding the three new formulas instead seems to have done the trick. THANK YOU!!! Pardon my ignorance here, but I "assume" I will need to change the formulas once we get to the end of Period 10 (October) 2017 so that it will roll over correctly for next year (2018)? Again, thank you very much for your assistance with this!

    T. Helm
  • 0 in reply to helmt01
    Correct - the year/month is hard coded (not good practice) but simpler to use as an example.
    You can just edit it each year or make the formula change dynamically with the date.