[]
        
(Showing Draft Content)

Complex Pivot Report

A complex pivot report contains a tablix with added groups.

What You Will Learn

This tutorial guides you through the steps to create a complex Pivot report by adding column groups to a tablix.

Note: You need to complete Create a Simple Pivot Report before performing following steps.

After you complete this tutorial, you will have a report that looks similar to the following.


Complex Pivot Report Example

Add Groups

After creating the simple Pivot report, let us add two groups to the MediaType column group - an adjacent group and a child group.


To add an adjacent group,

  1. Right-click the MediaType column group area to view options in the context menu.

  2. Go to Column Group and Select Adjacent-After.

    Add an adjacent group in the tablix data region

To add a child group,

  1. Right-click the MediaType column group area to view options in the context menu.

  2. Go to Column Group and select Child.

    Now, the tablix looks similar to the following.

    Child Group in Tablix Data Region

Bind Data to the Tablix Data Region

To add fields to the newly added groups,

  1. Drag and drop the Country field on the child group area.

  2. Drag and drop the SaleDate field on the group adjacent to MediaType column group.

To obtain the month value of sale date,

  1. Select the SaleDate column group.

  2. Go to the Properties pane and change the Value property to the following expression: {MonthName(Month(SaleDate))}

To display the month wise aggregate price,

  1. Drag and drop the Price field onto the body of the tablix.

  2. Select the body area containing Price field.

  3. Go to Properties pane and change the Value property to the following expression: {Sum(Price)}

    Now the tablix data region will look similar to the following.

    Tablix Data Region with Bound Fields

Manage Data

Since the data in a tablix expands across both rows (vertically) and columns (horizontally), you need to add groups and filters to manage such a large amount of data.


To manage how the added group data is rendered across rows and columns,

  1. From the Explorer Report Explorer Icon, select the Tablix data region.

  2. From the left pane of the designer, click the Group Editor icon Group Editor Icon to display row groups and column groups.

To limit the horizontal data in tablix, let us add a filter to the MediaType column group so that it displays only two types of media - VHS and DVD.

  1. Select Tablix1_MediaType_Group column group and go to the Properties pane.

  2. In the Filters property, click + Add to specify the filter conditions.

  3. Select the Any of, that is the OR, logical operator.

  4. Click the + Add to display the fields, and select the MediaType field and enter the filter value as 'VHS'.

    Setting the filtervalues for mediatype

  5. Again, click the + Add to display the fields and select the MediaType field, and enter the filter value as 'DVD'.

    Adding filters to the mediatype field

To display the month names once for SaleDate column group,

  1. Select Tablix1_SaleDate1_Group column group and go to the Properties pane.

  2. In the Group Expressions property, click Show Items and then select Add Item.

  3. Enter the following expression: {MonthName(Month(SaleDate))}

To display only the first three months of the year, that is, January, February, and March.

  1. Select Tablix1_SaleDate1_Group column group and go to the Properties pane.

  2. In the Filters property, click + Add to specify the filter conditions.

  3. Select the Any of, that is the OR, logical operator.

  4. Click the + Add to display the fields and select Expression.

  5. In the Expression Editor, enter the following expression: {MonthName(Month(SaleDate))}

  6. Enter its corresponding filter value as 'January'.

    Data filtering based on month values

  7. Again, click the + Add to enter the following expression in the Expression Editor: {MonthName(Month(SaleDate))}

  8. Then, enter its corresponding filter value as 'February'.

    Data filtering based on month values

  9. Now, for the last time, click the + Add to enter the following expression in the Expression Editor: {MonthName(Month(SaleDate))}

  10. Then, set the filter value as 'March'.

    Filtering data by month values

To sort the month names in the increasing order of month numbers,

  1. Select Tablix1_SaleDate1_Group column group and go to the Properties pane.

  2. Go to Sort Expressions property, click Show Items, and then click Add Item.

  3. Then, enter the following expression in the added item: {Month(SaleDate)}

  4. Set the sort order to ascending (default).

    Sort Expressions

Improve the Layout of Tablix Data Region

To manage the text and labels that appear in cells,

  1. Right-click the cell with the text 'Media Type' to view options in the context menu.

  2. Select Split Cells. Now we have a new cell adjacent to the cell with 'Media Type'.

  3. In the new cell, enter the text 'Months' to give a label to the SaleDate column group.

    Merge cells with adjacent empty cells

To merge cells with adjacent empty cells,

  1. Select the SaleDate column group and the empty cell below it, right-click, go to Cells, and select Merge Cells.

  2. Similarly, merge the corner area (top left area) of tablix with the empty cell below it.

  3. In the above-merged cell, change the text to 'Prices by Media Type and Months'.

    Merge cells with adjacent empty cells

Customize the Appearance of the Pivot Report

Customized Pivot Report

Note: You may need to resize and reposition the controls on the report to accommodate data and for a cleaner look.

Customize the body area and group area of the Tablix data region using the TEXT - Text Align (Left, Right, Center, and Justify.) and TEXT - Vertical Text Align (Top, Middle, or Bottom) properties. By default, these properties are set to General and Top.


Note that the background color and the font-weight properties are already applied, the same as the Media Type label.

Preview and Save Report

  1. Click Preview to view your report in the final output.

  2. Exit the preview mode by clicking Back on the left side of the designer.

  3. Click Save to open the Save dialog box. Enter the report name and click Save Report.