Search code examples
crystal-reportsreportreportinggroupingcrystal-reports-xi

Grouping in Crystal Reports crosstab


I'm using Crystal Reports XI R2 and want to build a table using crosstab functionality to display some data. The trouble is I don't want grouping on rows, eg. I want all rows (except the period) to be displayed underneath each other and not one row be a subgroup of another) I want it to look like this:

Period 1
       Group 1  value 1 | Summary field
       Group 1  value 2 | Summary field
       Group 1  value 3 | Summary field
       Group 2  value 1 | Summary field
       Group 2  value 2 | Summary field
       Group 3  value 1 | Summary field
       Group 3  value 2 | Summary field
       Group 3  value 3 | Summary field

Period 2
       Group 1  value 1 | Summary field
       Group 1  value 2 | Summary field
       Group 1  value 3 | Summary field

...

Instead of this:

Period 1
       Group 1 value 1 | Group 2 value 1 | Group 3 value 1 | Summary field 
                                         | Group 3 value 2 | Summary field 
                                         | Group 3 value 3 | Summary field 
                       | Group 2 value 2 | Group 3 value 1 | Summary field 
                                         | Group 3 value 2 | Summary field 
                                         | Group 3 value 3 | Summary field 

       Group 1 value 2 | Group 2 value 1 | Group 3 value 1 | Summary field 
                                         | Group 3 value 2 | Summary field 
                                         | Group 3 value 3 | Summary field 
                       | Group 2 value 2 | Group 3 value 1 | Summary field 
                                         | Group 3 value 2 | Summary field 

                                         | Group 3 value 3 | Summary field 
Period 2
       Group 1 value 1 | Group 2 value 1 | Group 3 value 1 | Summary field 
                                         | Group 3 value 2 | Summary field 
                                         | Group 3 value 3 | Summary field 

...

I want to group my data on Group 1 Field only (period, selected by the user, so it can by grouped by days, weeks, months, years - I already have a formula to work it out). The other fields are:

  • Group 2 (Flight Service Type, eg. Scheduled, charter, transfer etc.),

  • Group 3 (Airport Group Type, eg: Schengen/Non-Schengen, Continents,
    GCC/Non-GCC etc - those are defined by the user)

  • Group 4 (Flight direction - either Departure or Arrival).

As you can see, those three groups are not related to each other and each Flight belongs to ALL 3 of those groups (Eg. Flight A is Scheduled (group 2), Schengen (group 3) and Arrival (group 4)), and that's where I think the problem is.

Can this be achieved in Crystal Reports XI R2 using cross tabs?


Solution

  • Because these things aren't related you will need to move flight service, airport group, and flight direction to individual sub-reports (one for each). Place each sub-report in a separate GH1 section (i.e. GH1b, GH1c, GH1d)--GH1a will contain the group name and summary field.

    You'll group the data in each sub-report as desired.

    You can link the main report to each sub-report if you want to correlate the data.