SSRS Tutorial
SSRS Tutorial
• Report Designer can create reports of any complexity that Reporting Services
supports, but requires you to understand the structure of your data and to be able to
navigate the Visual Studio user interface.
• Report Builder provides a simpler user interface for creating ad hoc reports, directed
primarily at business users rather than developers. Report Builder requires a developer
or administrator to set up a data model before end users can create reports.
We’ll start our tour of Reporting Services with Report Designer. Report Designer runs inside the
Business Intelligence Development Studio shell, and offers several ways to create reports. You
can either use the Report Wizard to quickly create a report, or you can use a set of design tools
to build a report from scratch. You can also use the design tools to modify a report created with
the wizard.
Using the Report Wizard
The easiest way to create a report in Report Designer is to use the Report Wizard.
Like all wizards, the Report Wizard walks you through the process in step-by-step fashion. You
can make the following choices in the wizard:
Try It!
To create a simple report using the Report Wizard, follow these steps:
Try It!
To modify the report that you just created, follow these steps:
1. Right Click Dataset and click the Query tab which will open Query Designer
2. Select a Descending sort type for the ListPrice column and click OK.
3. Click the Design tab.
4. Click in the textbox at the top of the report, where the report name is displayed.
5. Right click and choose Text Box properties change the Value property of this control to
Products By Color.
6. Click on the header for the Product column.
7. Place the cursor between the Name and Product Number columns to display a double-
headed arrow. Hold down the mouse button and drag the cursor to the right to widen the
Name column.
8. Place the cursor between the Product Number and ListPrice columns to display a double-
headed arrow. Hold down the mouse button and drag the cursor to the right to widen the
Product Number column.
9. Click on the Preview tab to view the modified report, as shown in Figure 18-5.
Figure 18-5: Modified product report
Designing a Report From Scratch
You can also use Report Designer to build your own reports starting from scratch. In general,
you’ll follow these steps to create a report:
1. Create a Report project in Business Intelligence Design Studio.
2. Associate one or more datasets with the report.
3. Create a query from the dataset.
4. Build the report layout.
Try It!
To create a fresh report in Report Designer, follow these steps:
1. Select File and click Close project.
2. Select File New Project..
3. Select the Business Intelligence Projects project type.
4. Select the Report Server Project template.
5. Name the new report ProductReport2 and pick a convenient location to save it in.
6. Right-click on the Reports node in Solution Explorer and select Add New Item.
7. Select the Report template.
8. Name the new report ProductReport2.rdl and click Add.
9. Select the ReportData tab in the Report Designer.
10. Click New tab and choose Datasource under Data Source dialog box.
11. Name the new Data Source AdventureWorksDS.
12. Click the Edit button.
13. Connect to your local server and choose the AdventureWorks database.
14. Click OK.
15. Click OK again to create the data source.
16. Click Dataset to add new dataset for the report under dataset properties window click
Query Designer button to display the full query designer user interface.
17. Click the Add Table button.
18. Select the Location table.
19. Click Add.
20. Click Close.
21. Check the boxes for the Name and CostRate columns.
22. Sort the dataset in ascending order by Name.
23. Click the Layout tab to show the blank report layout.
24. Hover your mouse over the toolbox tab to display the available controls for the report.
25. Double-click the List control.
26. Expand the List control to the width of the report.
27. Expand the dataset in the Datasets window to show the column names.
28. Drag the Name and CostRate columns from the Datasets window and drop them in the List
control. Expand them horizontally until each takes up about half of the List control. Figure 18-6
shows the report in layout view.
Figure 18-6: Designing a report from scratch
29. Select the Preview tab to see the report with data.
Publishing a Report
Creating reports in Business Intelligence Development Studio is good for developers, but it
doesn’t help users at all. In order for the reports you build to be available to others, you must
publish them to your Reporting Services server. To publish a report, you can use the Build and
Deploy menu items in Business Intelligence Development Studio. Before you do this, you need
to check the project’s configuration to make sure that you’ve selected an appropriate server for
the deployment.
Try It!
To publish a report, follow these steps:
1. Close the ProductReport2 project.
2. Open the ProductReport1 project.
3. Select Project ProductReport1 Properties.
4. Click the Configuration Manager button.
5. Set the Active Solution Configuration to Release.
6. Make sure the Configuration is set to Release and both the Build and Deploy checkboxes are
checked. Figure 18-7 shows the Configuration Manager.
7. Click Close.
8. Fill in the URL for your Report Server. If you’re developing on the same computer where
Reporting Services is installed, and you installed in the default configuration, this will be
http://localhost:8080/ReportServer. Figure 18-8 shows the completed Property Pages.
9. Click OK.
10. Select Build Deploy ProductReport1. The Output Window will track the progress of BIDS
in deploying your report, as shown in Figure 18-9. Depending on the speed of your computer,
building the report may take some time.
Try It!
To create a data model, follow these steps:
1. If it’s not already open, launch Business Intelligence Development Studio
2. Select File New Project.
3. Select the Business Intelligence Projects project type.
4. Select the Report Model Project template.
5. Name the new project AWSales and save it in a convenient location.
6. Click OK.
7. Right-click on Data Sources in Solution Explorer and select Add New Data Source.
8. Read the first page of the Add New Data Source Wizard and click Next.
9. Click New.
10. In the Connection Manager dialog box connect to the AdventureWorks database on your
local server and click OK.
11. Click Next.
12. Name the new data source AdventureWorks2008 and click Finish.
13. Right-click on Data Source Views in Solution Explorer and select Add New Data Source View.
14. Read the first page of the Add New Data Source View Wizard and click Next.
15. Select the AdventureWorks data source and click Next.
16. Select the Production.Product table and click the > button to move it to the Included
Objects listbox.
17. Select the Sales.SalesOrderDetail table and click the > button to move it to the Included
Objects listbox.
18. Click the Add Related Tables button.
19. Click Next.
20. Name it ‘ProductSales’ and click Finish.
21. Right-click on Report Models in Solution Explorer and select Add New Report Model.
22. Read the first page of the Report Model Wizard and click Next.
23. Select the ProductSales data source view and click Next.
24. Keep the default rules selection, as shown in Figure 18-10, and click Next.
(To install Report Builder, click the Report Builder link in the home page menu bar.
Report Builder will automatically load up all of the available report models and wait for you to
choose one to build a report from.)
Try It!
1. Open a browser window and navigate to http://localhost:8080/Reports (or to the
appropriate Report Server URL if you’re not working on the report server).
2. Click the Report Builder link.
3. Depending on your operating system, you may have to confirm that you want to run the
application.
4. After Report Builder is installed, select the ProductSales report model and the table report
layout. Click OK. Figure 18-12 shows the new blank report that Report Builder will create.
Figure 18-12: New report in Report Builder
[The Explorer window to the left of the design surface shows all of the tables in the report
model. Beneath that, the Fields window shows the entities in the currently-selected table. Note
that not everything in this window is a column in the table: the report model also contains
aggregate entities such as Total Safety Stock Level and automatically calculated fields.]
Exercises
Use Report Builder to create a report from the AdventureWorks data model showing the
minimum and maximum order quantity for orders taken by each salesperson in the company.
You’ll find the necessary data in the SalesOrderHeader and SalesOrderDetail tables.
Solutions to Exercises
1. Open a browser window and navigate to http://localhost:8080/Reports (or to the
appropriate Report Server URL if you’re not working on the report server).
2. Click the Report Builder link.
3. Select the AdventureWorks report model and the table report layout.
4. Click OK.
5. Select the Sales Order Header table.
6. Drag the Sales Person ID field and drop it in the area labeled Drag and Drop Column Fields.
7. Click on Sales Order Details in the Explorer window.
8. Expand the Total Order Qty field in the Fields window to show the alternative fields beneath
it.
9. Drag the Min Order Qty field and drop it to the right of the Name field.
10. Drag the Max Order Qty field and drop it to the right of the Min Order Qty field.
11. Click where it says Click to Add Title and type Sales Performance.
12. Click the Run Report button to produce the report shown in Figure 18-15.
Figure 18-15: Sales performance report
Designing a parameterized Report