Avatar of Taras
Flag for Canada

asked on 

Crystal Report Rolling month- three months -YTD with previous year comparison

In Crystal Report 2008 .
I am working on one my old report that calculating rolling amounts from customer that have orders from different suppliers.
Columns that I need to compare are: Month, Three Months and Year (6 columns)
-      Full selected month this year to the same month previous year;
-       Three months back from selected month this year to the same three months in previous year
-      Current YTD up to full selected month to previous year to date.
Condition is that only Customers should be included that have orders from suppliers which are older than two years from selected date.
One customer can have several suppliers and one supplier can have several customers.
It means those customers have to have order older that two years from parameter date but they can have beside those  at the same time orders that are not older that two years too.
I need grouping on Suppliers and then their Customers and calculating those values for each customer with total for supplier.

Customer which do not have any orders (amounts) in previous year column should not be included in calculation and should not be shown in report.
I have problem how to restrict and not showing customers which do not have orders in previous year(even they could have in this year).

I created one Main report and two subreports (rpt_Main; rpt_SubMainA; rpt_SubMainB).
In rpt_SubMainA I presented every Supplier with their customer and do those calculation in columns.
In rpt_SumMainB I show only final summaries rows from sub reports rpt_SubMainA.

In rpt_Main I have shared variable “OldCusomers” where I collected all  customers that have orders older than two years from parameter(par_Run_Date) which I use as date for calculation.
Then I passed that shared variable value to be used as criteria in  rpt_SubMainA  plus added condition that orders in this sub report have to be in range previous YTD and Current YTD.

In subreport rep_SubMainA  I have grouping on Suppliers then Customers.

 Everything looks ok up to user asked me not to show those Customers that do not have any orders during previous year (even they could have orders during this year but if they do not have in previous year they should not be include and calculated.
Not sure how to solve this any idea?
Crystal Reports

Avatar of undefined
Last Comment
Mike McCracken

8/22/2022 - Mon