SSRS Subreports

In SSRS, Subreports allows us to add one or more related reports to the Data region. The following are some of the advantages of SSRS subreports:

  • Enable us to add Multiple related reports in one Report.
  • SSRS subreports allow us to Nest or Insert One report inside the other.
  • And, allows us to pass parameters (Parameter values) from the main report to the SSRS subreport
  • If you place the SSRS subreport inside the table or matrix, then Subreport will be repeated for each row. Otherwise, it will display once.

SSRS Subreports Example

In this example, we will show you how to create SSRS Subreports inside the Table Reports with an example.

For this SSRS subreports example, we are going to use the below-shown report. Please refer to the Table Reports article to understand the Shared Data Source and Dataset we used in this SQL Server Reporting Services report.

SSRS Subreports 1

The below screenshot shows you the second report, and this is the report we are going to display inside the main report (Subreport). Please refer to the SSRS Data Bars article to know the Data Source & Dataset we used in this report, and we have done some formatting as well.

If you observe, It’s just an ordinary report with Basic Parameter and its default value in Australia.

SSRS Subreports 2

First, We are going to hide the Parameter because we are going to pass the parameter value from the main report to this Subreport. To hide the Parameter, Right-click on the Parameter, and select the Report Properties option.

In the general tab, Please change the parameter visibility option from Visible to Hidden as shown below

SSRS Subreports 3

Before we nest the Subreports in SSRS, we need an Empty Row inside the table. So select the Details Row from Tablix and right-click on it to open the context. From the context menu, please select the Insert Row option and select Inside Group – Below as shown below

SSRS Subreports 4

Once you choose Inside Group – Below option, a new Row will be added to the table

SSRS Subreports 5

From the above screenshot, see that the newly created row split into two cells, but we need a single cell only for adding subreports.

For this, Please select the entire row and right-click on it and select the Merge Cells option as shown below

SSRS Subreports 6

Now you can notice that we have one long cell to hold the subreport. Let’s add the subreport to this cell

SSRS Subreports 7

There are two ways to add subreport in SSRS:

The First Approach to add Subreports in SSRS

First, We can drag and drop the Subreport from Toolbox to empty cell as shown below

SSRS Subreports 8

The Second Approach to add Subreports in SSRS

Right-click on the empty cell and select the Insert option and then select the Subreport option

SSRS Subreports 9

Once you chose the Subreport option, an empty subreport added to the table.

Now, we have to add our report to this subreport region. So, Right-click on the SSRS Subreport and select the Subreport Properties.. option from the context menu

SSRS Subreports 10

Selecting the Subreport Properties.. option opens a new window to select the report. For now, we are selecting Polished Data bar report as shown below

SSRS Subreports 11

After selecting the required report, We have to assign the Parameter’s value(s) of an SSRS subreport (If any). To add the Parameter, go to the Parameters tab and click on the Add button.

Under the name section, Please select the Parameter name of the subreport

SSRS Subreports 12

Next, We have to assign proper value to the selected Parameter. Here, ParaCountry Parameter is expecting country names. So we picked the [Sales Territory Country] column from the main report.

NOTE: If you don’t find the exact column in the main report, Use the fx button to create one.

SSRS Subreports 13

Click Ok to finish creating SSRS Subreports in Table Report

SSRS Subreports 14

Let us see the subreports report preview by clicking the preview tab.

SSRS Subreports 15

As you can observe from the above screenshot, SSRS Subreport correctly nested inside the main report. Please don’t mind with color combinations.