Using Cross Tabs

Cross-tabs within Crystal Reports .NET can be used to display summarized data in rows and columns, similar to a spreadsheet. If you want to create a report with a cross-tab as its main feature, there is a Cross-Tab Expert available that will guide you through the steps to do so.

You can also insert a cross-tab into an existing report, which we will walk through here. You may want to create a copy of the report we have been working with before starting this section. That way you can always return to the original, which we will use a little later for charting. To insert a cross-tab into your report, right-click the report and then select Insert ^ Cross-Tab from the menu, as shown in Figure 3-22.

Insert k


Format Section...

Speciai Field ► Text Object

Database * Report i Designer ►

Subtotal... Grand Total... Summary...

Close Subreport

Group... Section...

Set CSS Class...

Undo (Ctrl+ZJ: Resize Object


Cross Tab...


Cut Copy Paste Delete

Line Elux

Picture... Chart...

Register / Change Address...

OLE Object... Hyperlink...

Cancel Menu

Figure 3-22

Figure 3-22

This makes a box appear over your cursor, which you should position over your report where you want it to appear. Place the cursor over the Group Header #1: Customer.Country - A section, next to the Group #1 Name label. Left-click the mouse, and the dialog shown in Figure 3-23 will open. When working with a cross-tab, there are three basic elements: rows, columns, and summarized fields. To start, you will need to select at least one of each using this dialog.

Figure 3-23

Select Customer.Country for the row and Customer.Region for the column. Select Customer.Last Year's Sales so it is highlighted, and then click the Add Summarized Field button so Sum of Customer.Last Year's Sales appears in the summarized field. Click OK to create this cross-tab.

In the first section under each country, your report now has a summary of the last year's sales by region. In the screenshot shown in Figure 3-24, we have the sales by region for the USA. If you select England in the list to the left of the report, the same cross-tab will appear with values for the regions in England.

By default, Crystal Reports .NET applies some standard formatting to your cross-tab and draws lines and boxes around the columns and rows. With the use of a style sheet, you can apply a predefined style to your cross-tab, as shown in Figure 3-25, or simply change individual attributes to suit.

Cross-tabs have come a long way since the early version of Crystal Reports. Now if the data runs off the page, it is continued on the next page and a margin is used so the data is not cut off, eliminating the old problem of taping multiple report pages back together.

The only down side is that there are still some issues with page numbering. If your cross-tab runs across multiple pages, the page number will not work correctly (for instance, if it is three pages across and three down when printed, only the first and every third page will have a number, and it will be 1...2...3). Still, those limitations are minor in comparison to the functionality provided.

Multi Row Crosstab Crystal Report
Figure 3-24


Main Report i



Was this article helpful?

+1 -1


  • harry
    How to display label in crystal report when cross table used?
    6 years ago
  • sue
    How to shift rows to the right side in cross tab in crystal report?
    6 years ago
  • michelino
    How to show multiple records in crystal report cross tab using
    6 years ago
  • nerea
    How to give the crosstab title in crystal report
    6 years ago
  • Hugo
    Can you create multiple Crystal reports using tabs?
    6 years ago
  • Melanie
    How to insert average for a cross tab with 2 summarized fields crystal reports?
    6 years ago
  • Patrick
    How to insert crosstab in crystal reports visual studio?
    5 years ago
  • Daniela
    How to create crystal reports crosstab?
    5 years ago
  • tiblets
    How to bind data in crystal report cross table in
    4 years ago
  • Calvin Jones
    How to create boxes around report sections in crystal report using
    2 years ago
  • tuulia
    How to create subtotal formula for text object in Crystal reports in vb6.0?
    2 years ago
  • isabella ferguson
    How to insert subtotal of a text object in Crystal reports in vb6.0?
    2 years ago
  • letizia
    How to Grand total a crystal report text object in vb6.0?
    2 years ago
  • simone
    What are the colored tabs inside of crystal reports connections links tab?
    9 months ago

Post a comment