Sub Report using SSRS

Introduction

This article shows how to use a sub-report for a SSRS report.

Create a Report Server project as in Figure 1.

 

Figure 1: Report server project

Add a report as in Figures 2 and 3.

 

Figure 2: Add new item

 

Figure 3: Employee report

Insert a table as in Figure 4.

 

Figure 4: Add table

Set the shared datasource properties as in Figure 5.

 

Figure 5: Add datasource

Choose a data source and create a query for employeedataset as in Figure 6.

 

Figure 6: Choose datasource

Choose a data source and create a query for departmentdataset as in Figure 7.

 

Figure 7: Select stored procedure

Create a Department report as in Figure 8.

 

Figure 8: Add department report

Create Employeedataset as in Figure 9.

 

Figure 9: Employee dataset

Insert a row, an insert group below as in Figure 10.

 

Figure 10: Insert row - inside group below

Create a parameter for the Department dataset as in Figure 11.

 

Figure 11: Department dataset

Add a parameter for department as in Figure 12.

 

Figure 12: Add parameter

Add deptId as in Figure 13.

 

Figure 13: Parameter properties 

Add departmentId filter as in Figure 14.

 

Figure 14: Add filter

Add a subreport as in Figure 15.

 

Figure 15: Select subreport

Set the sub-report properties as in Figure 16.

 

Figure 16: Department report as subreport

Set the sub-report parameters as in Figure 17.

 

Figure 17: Add parameter

Figure 18 shows The Output of the basic sub-report.

 

Figure 18: Output

Summary

In this article we saw how to use sub-reports for a SSRS report.