Question

Using Crystal Reports for VS2010.

I have the following requirement for a standalone CR.:

From the indicated start date, retrieve all sales records from the table for the next 12 months. StartDate is the parameter that report uses and user selects.

Columns are as under: Month1 is the month of the StartDate followed by consecutive months.

Column1     Column2      Month1 Month2 M3  M4  M5  M6  M7  M8  M9  M10 M11  M12

For eg: If StartDate is 01/05/2013 (May 2013) then columns should be:

Column1     Column2      May13 Jun13 Jul13  Aug13  Sep13  Oct13  Nov13  Dec13  Jan14  Feb14 Mar14  Apr14

Would really appreciate if someone could point me to links or give some directions on how to achieve this.

UPDATE:

I have managed to achieve the Dynamic column headers using formula

ToText(DateAdd('m', 1, {?StartDate}), 'MMM yy')

I am stuck figuring out a formula to get the data value in the Detail section. If field name is {Sales.Extension} how do I calculate the Sum of Extension for that Month only.

Was it helpful?

Solution

To the extent I understand the problem you can use below solution.

  1. Create a formula and write below code and place in detail section.

    If ToText(DateAdd('m', 1, {?StartDate}), 'MMM yy')= ToText(DateAdd('m', 1, <<Database Field>>), 'MMM yy') Then {Sales.Extension}

write above formula for all columns in report.

If you need the summary then take summary of the field placed in detail section.

OTHER TIPS

Use a cross-tab; add the sales date to the columns area; group by month. Add the value to be summarized to the rows area.

Record-selection formula:

{table.sales_date} IN {?StartDate} TO DateAdd("m", 12, {?StartDate})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top