Crystal Reports Cross-Tab Data Population

SOLVED

I am creating a cross-tab report in crystal reports based on AR_InvoiceHistoryHeader and Detail. I am trying to summarize the number of shipped units per month for a particular year. I have this working fine, except that if there is no data for a given month then the month is not listed. This is only an issue because the report needs to be exportable to Excel and they like each month of a year represented with a column even if the value is 0. For instance, we went live on Sage 100 August of last year so I have no columns for Jan-Jul. I'm assuming I'll need to write a formula to accomplish this and base the crosstab on the formula. Any suggestions?

Example:

I have a new item that shipped 50 units in March and had never been shipped before. Currently I would see:

                          Mar           Total

Customer X:     50               50

What I need to see:

                          Jan          Feb         Mar         Apr         May         Jun         Jul         Aug         Sep         Oct         Nov         Dec         Total

Customer X:     0               0             50            0             0              0             0             0              0              0             0              0              50

  • 0

    A normal report with 12 formula fields for the summations is what we usually do.

  • 0 in reply to Kevin M

    I've accomplished this before through using formulas that took advantage of NumberVars.

    In this case my Group #1 is Item Code, Group #2 is InvoiceDate grouped monthly, and Group #3 is CustomerNo. I could accomplish what I need by placing the following formula in the InvoiceDate group header (suppressed) and the CustomerNo header (just to show the data) doing something like:

    whileprintingrecords;

    numbervar Jan;

    Jan:=if month({AR_InvoiceHistoryHeader.InvoiceDate})= 1 then Jan+(Sum ({AR_InvoiceHistoryDetail.QuantityShipped}, {AR_InvoiceHistoryHeader.InvoiceDate}, "monthly")) else Jan

    I could repeat that same type of formula 12 times, once for each month which is what I have done in the past. Is that the best way to go about accomplishing what I need? It just seems a bit messy.

  • 0 in reply to Jon_K
    verified answer

    Formula field JanQuantity, passing through the line quantity when the invoice is the correct month.  Sum this formula in a group header / footer (adding in a null test somewhere if you need to force "0" when there are no results).  Create similar fields for all the months.

    This method gives you line data, so you can sum this type of field at different group levels without it getting too complicated.  Sure, this is not elegant, but it is simple and works.

  • 0

    Ok I'll bite, what's wrong with the Customer Sales History by Item in Sales Order? It lets you select the year and it displays all the months just as you are doing.

  • 0 in reply to BigLouie

    You are right, I would have been better off just adjusting the format of that report to what I need.