Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
162 views

SSRS Tutorial

SSRS or SQL Server Reporting Services is a tool for creating reports from SQL Server databases. It allows users to create tabular, graphical, and interactive reports that can be viewed and exported from web browsers. Reports in SSRS can be automatically delivered via email or saved to a shared location. SSRS also provides security features to control report access. The document then provides steps for installing SSRS and creating a simple sample report to demonstrate its basic features.

Uploaded by

itkrishna1988
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views

SSRS Tutorial

SSRS or SQL Server Reporting Services is a tool for creating reports from SQL Server databases. It allows users to create tabular, graphical, and interactive reports that can be viewed and exported from web browsers. Reports in SSRS can be automatically delivered via email or saved to a shared location. SSRS also provides security features to control report access. The document then provides steps for installing SSRS and creating a simple sample report to demonstrate its basic features.

Uploaded by

itkrishna1988
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

Lesson 1: What is SSRS?

 SSRS or SQL server Reporting Services which is also called Microsoft SQL reporting, is a component
of the Microsoft BI stack.

 The Microsoft Business Intelligence Stack mainly consists of SQL Database Engine, SSRS, SSAS, SSIS
and other tools

 SSRS is a set of readymade tools, which helps you to create, deploy and manage reports.

 You can extend reporting functionality using C# and VB as programming languages.

 Microsoft SSRS or Business Intelligence SSRS, let’s you create very rich reports
(Tabular/Graphical/Interactive/free-form) from various datasources with rich data visualization
(Charts, Maps, sparklines).

 All these reports can be viewed via a web browsers.

 SSRS allows are reports to be exported in various formats (Excel, PDF, word etc)

 SSRS allows reports to be delivered via emails or dropped to a share location in an automated
fashion.

 SSRS provides a host of security features, in order to control, who sees which reports etc.

 You can download some samples from here.

 Next, look at how to install SSRS and get you started.


Lesson 2: SQL Server Reporting Services Installation

Move forward with getting to know how to install sql server 2008 reporting services. Please note, most
of the steps are the same for installing sql server reporting services 2005.
Below are the steps to install SQL reporting services 2008 with express Database.

Step 1: Download the 64 bit or 32 bit version of SQL 2008 Express with advances services from here .

Step 2: Right Click on the downloaded file and "Run as Administrator".

Step 3: The files will extract itself.


Step 4: In case you get a pop-up saying "This program has compatibility issues", click Run Program.

Step 5: You should be getting a progress screen.

Step 6: The SQL server Installation Center should fire up.


Step 7: Select installation on right hand tab and click on "New SQL server stand -alone installation"
Step 8: SQL server will load the setup files.

Step 9: Click OK, it should take you to next page.


Step 10: Click Install.

Step 11: Click next, then again next.

Step 12: Click next


Step 13: In feature selection, make sure you select 'Database Engine Services' and 'Reporting Services'

Step 14: Next, select Named Instance and give it any name (you can also choose Default instance)

Step 15: Click next


Step 16: Select Mixed Mode --> enter in any password --> and specify SQL server admins.

Step 17: Click next, and select 'Install, but do not configure under Reporting Services configuration.
Step 18: Click Next

Step 19: Click Next


Step 20: Click Install.

Step 21: After Installation is done, click next


Step 22: Click Next.

Your installation is almost complete. In order to start using SSRS, you need to perform a few more steps.

Step 23: Click Start --> All programs --> Microsoft SQL 2008 --> Configuration Tools --> Reporting Services
Configuration --> select your instance

Step 24 : Click web service URL on the left hand side and click the apply button.
Step 25: Click database on the left hand side, select change database --> create a new report server
database and complete the steps.

Step 26: Click report manager URL and click apply (Note down the URL displayed. It should be of the
form http://machinename/reports)

Step 27: open IE and hit the noted down URL

Step 28: You should get a screen like this.

That's all. We are all set. install some sample databases and get started learning SSRS 2008
Lesson 3: Installing Sample databases (Adventure Works)

Next, install some sample databases for us to work with. One of the most commonly used databases is
the SQL adventure works database. SQL server adventureworks database download is available here.

Once you download the database, look at how to setup sql database.

Step 1: Install your downloaded database (sql server 2008 sample databases download), by choosing the
correct instance name.

Step 2: After installation, open SSMS --> your instance name, then check if the below databases are
visible.

Step 3: You can also install some sample reports from here
Lesson 4: Creating your first SSRS report.
Now that you are all set with installing SSRS 2008 and some SQL server adventure works database, Let
us proceed with creating our first SSRS report, deploying the same and viewing in the web browser. For
report development, we will use Microsoft Business Intelligence Development studio. Quite often
people ask me, how to install Business intelligence Development studio. Installing business intelligence
Development studio, is as simple as adding components to an existing SQL installation. Just run the SQL
setup again, and choose add features to an existing installation, and choose select the required features
you need.

Follow a step by step process to create your first Business Intelligence Report.

Step 1: Open Business Intelligence Development Studio (BIDS) (Start --> Microsoft SQL server 2008 -->
SQL server Business Intelligence studio

Step 2: Click File --> New project --> Report Server Project Wizard. Give any name and location.

Step 3: Once you click OK, you will be presented with the following screen.
Step 4: Click Next. Now configure your connection string. I have chosen the type as 'Microsoft SQL
server'
Step 5: In this step, you need to enter the query for the data, that you need the SSRS report to be
populated with. You can also use the query builder.

Step 6: Click on query builder, and click on the right most top icon, to add tables
Step 7: Select the necessary table, and verify your query, then click the (!) icon to see the result of the
query after execution.

Step 8: If everything looks good, click on Next


Step 9: Click Next

Step 10: Add the fields, as shown in the below screenshot.


Step 11: Click next
Step 12: Choose a style, and click next.

Step 13: Choose a deployment location. It will be in the form (http://machinename/Reportserver)

Step 14: Click Next.


Step 15: You can preview the report in Business Intelligence Development Studio.

Step 16: Now, Right click the project, and click deploy.
Step 17: After successfully deploying the project, open up IE, and hit http://machinename/reports

Step 18: Click on your report to open it.

Congratulations! You have made your first SSRS report.


Lesson 5: Knowing your development env. (BIDS)

Alright, now we have published our first simple SSRS report using the Reporting Wizard. We deployed
the report, and viewed it via a web browser. Next, we will understand, how to develop reports, without
the custom report creation wizard. This will give much better control, over developing custom reports.
(Eg. you need to add custom calculations, embed maps etc.

When you fire up, Microsoft Business Intelligence Development studio - it looks like this.

The Left side portion, is where you set up your data connections, what parameters your report should
use, the queries that return data for your report etc.

The middle portion, is where you actually develop the report. Eg. Setup tabular reports, matrix reports
or embed maps, graphics etc

The Right side portion, is called the solution explorer. It lists down all reports (also called RDL's or report
definition language) to be displayed. Report definition languages are pure XML file.

Pressing control+Alt+X brings up the toolbox.


Here you see a number of tools that aid you in your report development. You simply need to drag and
drop the tools, that you need in your report, and then configure it accordingly.
We will have a look at some of them in the coming lessons.
Lesson 6: Making your first SSRS report (non-wizard) method

Let’s proceed towards making a simple SSRS report.


This time, we will not be using the wizard to create our report, but we will make use of the toolbox, and
report designer to create our report.

Most of the report development that you do using Microsoft SQL server reporting services, would be
using the non-wizard method. This allows more flexibility to your report development.

Step 1: Open Microsoft Business Intelligence studio, and create a report server project.

Step 2: Next let’s configure the datasources and datasets.

Step 3: right click on the "Data sources" folder and add a new data source.
Set the connection string to point to your new adventure works database.

Step 4: Once that is done, right click on the datasets folder, to add a dataset.
This is basically the place, where you will configure your query that returns some data that you want to
be displayed in the report.

Select the datasource, that you just created and type in a query.
You could also use the "Query Designer" if you want.
After everything is done, click ok

Step 5: Now from the toolbox, drag and drop a table control.
Step 6: From the "Report Data", drag and drop the columns defined in the dataset that you want in the
report.

Step 7: That's it, click on the preview tab and congratulations, you have made your first Microsoft SQL
server report using a non-wizard method.
Lesson 7: Creating an SSRS parameterized report

Let’s proceed towards making a simple SSRS report with parameters.


This lesson, should give you an idea, as to how to control the data in the reports using parameters.
Let’s consider the same report that we made in Lesson 6.

We are going to expose the postal code as a parameter. This means, we will see the address of only the
entered postal code.

Step 1: Modify the query in the dataset, to make PostalCode as a parameter


Step 2: Once you click OK, go to the parameters folder in "Report Data" - you will find that @postalcode
automatically appears in the "Parameters" Fields.

Step 3: Let’s explore more about the parameter. Double click on @postalcode.
This is place, where you configure, how your parameter should behave - should it allow blank values or
null values etc.
You can configure the visibility, data-types, default values etc.
Let’s leave it as it is for now.
Step 4: Click preview, and enter in a postal code (91370 for example)

Note: Observe that the parameter appears as a text box here.


If you want pre-configured values (in a dropdown), double click on the parameter in "ReportData" -->
Parameters (here, @postalcode) and click "Available Values"/"Default value" and click "Get values from
a query". You can choose your dataset and corresponding column. Create multiple datasets to suffice
your parameter value requirements.
Lesson 8: SSRS Expressions

Next, let’s move on to creating expressions in SQL server reports.


Expressions can be used for a number of things. The best part is that it operates on a cell by cell basis.
Hence, you can write expressions to manipulate the data, or change the properties of cell etc. Even if
you are dealing with graphs and maps, many of the properties, you can control using expressions (like
color of graph, some values etc).
Basically you would want to write expressions, if you need to manipulate properties/data at runtime

Let’s look at a very simple example.

Step 1: Create a report server project and connect to Adventure Works Database.
Step 2: Add the SalesOrderDetail table with a couple of columns to the Report.

Step 3: In the toolbox, add the table control to the report.


Step 4: Add 3 columns to the report - SalesOrderID, SalesOrderDetailID, OrderQty, LineTotal.

Step 5: Now let’s write some expressions. We will display anything in LineTotal cell as Green, if the
number is above 2000, else we will display in Red.
Right click on the cell, and select text-box properties.
Step 6: Next to the color dropdown, there is an Fx button.
Write the below expression.

Step 7: Click OK and then on the Preview button.


You should be getting the final output as displayed below.

Step 8: Now let’s write some expressions to manipulate some data.


Right click on the OrderQuantity Cell and click on expressions.
Enter the below expression and click OK.
Step 9: Click on the preview tab, you should get the below output.

I have demonstrated a very simple use of expressions. However, you can write very complex expressions
depending on your business needs. For instance, you can write expressions, to calculate the standard
deviation of so and so, and manipulate results accordingly.
Many time, you need to write expressions to deal with Dates and times
for information on: http://msdn.microsoft.com/en-us/library/ms157328.aspx
Lesson 9: Creating a SSRS tabular report

Creating SSRS tabular reports, is one of the simplest and easiest task.
Tabular reports implies, just simple data representation using tables.
SSRS makes creating tabular report super simple - just drag and drop data elements.
It gives you the ability to add totals etc, as we do in excel.

Let’s look at some basic steps to create a SSRS tabular report.

Step 1:
Create an SSRS report server project.

Step 2:
Next add a blank report to your project.

Step 3:
Next we need to create a Dataset.
In the Report data tab, right click on Datasets and complete the wizard.
I am using Adventure works database for this demo.
Step 4: Add a query to get some data to your report.

Step 5: Now drag and drop a table control from the tool box (Left hand pane)
In the table control, drag and drop some fields from your dataset.
Once done, your Design pane should look something like this.

Step 6: Click on the preview tab, and you should be able to see a very basic tabular report.
Step 7: You could also add some totals to your report.
In order to add totals, right click on the cell where you would like to add the totals, click on 'Add Total'.
Click preview and you should be able to see a tabular report with totals.

Lesson 10: Formatting an SSRS report.

In this tutorial, let’s look at how to format an SSRS report.


SSRS, just like Microsoft word or any other text tool, provides some WYSIWYG editor.
That means at design you can format the text (make it bold, italicize etc).
SSRS also has some ways where-in you can format the display of dates, currency etc.
Let’s look at some of them in this tutorial.

Step 1:
Create a basic tabular report, using Adventure works database.
The report would look something like this.

Making the headings bold, Italics, underlined.

Step 2:
In the design view, select the cells in the report, where you want to apply the formatting.
You could either use any of the shortcut keys (like cntrl + B, cntrl + I, cntrl + U) on you can use the icons
in the toolbar.
Similarly try adding some background color or text color.
Play around with bullets and numbering.
The same toolbar, also allows you to set the alignment of text.

Step 3:
Some of the features are given in the screenshot below.

Step 4: Let’s explore some other formatting features.


Let’s create a report, which has some dates and some currency.
Preferably you can use the following query from AdventureWorks database.

SELECT TOP (100) * FROM Sales.SalesOrderDetail


Step 5: Once you create a report, using the above query, your report would look something like this.

Step 6: Now let’s play around with some Currency formatting and date formatting.
Right click on the unit price cell.
Click on text box properties.
On the left hand pane, click Number --> Currency
Step 7: Now let’s do some formatting for dates.
Right click on ModifiedDate --> Number --> Date

Step 8: After choosing your money and date format, click preview and report should look something like
this.
Lesson 11: SSRS grouping and totals

Many times we need to group the data in order to drill down further.
To put it simply, imagine you have a report which gives you sales amount for each of the continent.

You might want to drill down into each of these continents and see the sales amount for each country in
the continent.

Next, you might want to drill down further to see the sales amount for each state in a country.

Next you might want to drill down from yearly sales to say quarterly...and so on a so forth.

This is where we introduce Groups and drill downs If you have used the Group By clause, for
aggregation, you might know, what I am talking about.

In any case, let’s take an example from the adventure works database.

Let’s consider 4 tables from AdventureWorks 2008 R2


1. Fact Internet Sales
2. DimDate
3. DimSalesTerritory
4. DimProduct
5. DimCustomer.

If you run the below query in SQL Server, you will get the following:
Query:

SELECT D.CalendarYear AS [Year]


,D.CalendarQuarter AS [Quarter]
,D.EnglishMonthName AS [Month]
,D.FullDateAlternateKey AS [Date]
,B.EnglishProductName AS [ProductName]
,C.FirstName + ' ' + LastName AS [CustomerName]
,ST.SalesTerritoryRegion AS [SalesRegion]
,ST.SalesTerritoryCountry AS [SalesCountry]
,A.SalesOrderNumber AS [OrderNumber]
,A.SalesAmount
FROM FactInternetSales A
JOIN DimProduct B
ON B.ProductKey = A.ProductKey
JOIN DimCustomer C
ON C.CustomerKey = A.CustomerKey
JOIN DimDate D
ON D.DateKey = A.OrderDateKey
JOIN DimSalesTerritory ST
ON ST.SalesTerritoryKey = A.SalesTerritoryKey

Now we have some data with us to work with.

Let’s use this data in our report and group the data.
Then we will introduce drill through in our reports.

Step 1: Make a report, with a table control by dragging and dropping CustomerName, OrderNumber and
SalesAmount.
Hit preview - Your report should look something like this.
Step 2:
Now let’s add a product name, and let’s put the customer Name, order number and Sales Amount under
it.

Right click on the grouping area --> Add group --> Parent Group --> Group by 'Product Name' (Also Add a
group header)

Hit preview. Your report should look something like this.


So let’s add more groupings.
Year--Quarter--Month--Date--SalesRegion--SalesCountry--ProductName-Details

so your design view should look something like this:


And your output should look something like this:
Lesson 12: Using SSRS web services

SSRS exposes all functionality of reporting services through Web service.


It’s basically a XML web service and has a SOAP API.
It provides 2 endpoints:
1. Report execution
2. Report Management

Mainly there are 2 ways to use the SSRS web services:


1. Using Microsoft.NET Framework
2. Using RS.exe

let’s look at an example to use SSRS web services using Microsoft C#.

Step 1:
Create a Visual studio 2010 console application (you can use any Visual Studio version)
I am calling the application MyFirstSSRSWebService.

Step 2:
Next click add service reference:
Step 3:
Click advanced--> add web reference -- url - http://localhost/reportserver/reportservice2005.asmx
(replace localhost with your report server name).
Then click add reference

Step 4:
You should be seeing the SSRS webservice that you just added, in the solution explorer:
Step 5:
I have created a report called MyFirstReport in my local, and given it a small description.
Step 6:
Now let’s try to programmatically display this report name and the description
Copy paste the following c# code:

using System;
using MyFirstSSRSWebService.myPC;

namespace MyFirstSSRSWebService
{
class Program
{
static void Main(string[] args)
{
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = "http://localhost/reportserver_SSRSexpress/reportservice2005.asmx";

Property name = new Property();


name.Name = "Name";

Property description = new Property();


description.Name = "Description";

Property[] properties = new Property[2];


properties[0] = name;
properties[1] = description;

try
{
Property[] returnProperties = rs.GetProperties(
"/HelloWorld/MyFirstReport", properties);

foreach (Property p in returnProperties)


{
Console.WriteLine(p.Name + ": " + p.Value);
}
Console.ReadKey();
}

catch (Exception e)
{
Console.WriteLine(e.Message);
Console.ReadKey();
}
}
}
}
Step 7: Run the code, you should be seeing the following output

Likewise, I would encourage you to explore other methods of this web service as well.
One common activity people do, is to programmatically render a report in excel/pdf etc
Lesson 13: SSRS Subscriptions - Email Based

Subscriptions are delivery mechanisms for delivering a report to a user.


Subscriptions allow us to schedule a report, to be run and delivered in many formats (Excel/PDF etc) as
an email or to be dropped in a file share at any pre-defined time.

There are mainly 2 types of subscriptions:


1.Standard
2.Data-Driven Subscription.

It also has 2 delivery mechanisms:


1.Email based
2.File Share based.

Let’s discuss the email based subscription.


This demo is based on SSRS 2008 R2
Step 1: After I navigate to my ReportServer page, I should be seeing something like this:

Step 2: Select the report, and click subscribe.


Step 3: if the credentials are not stored, you will get the following error message.

Navigate again to the report and click manage:


Goto the data sources tab, and enter the credentials:
Click on apply and then click on subscriptions tab.
You should be seeing a screen something like this:

Click on New subscription.

You should be presented with a screen like this:

Select delivered by: Email


Type in To, CC, BCC
Select a report rendering format.
Select a schedule.
Click OK

the report should be available in your inbox, at your specified time.


Lesson 15: SSRS Matrix Reports

Tablix is a new feature introduced in SSRS 2008.


Tablix combines the features of a tabular report and cross tab features.
A tablix report, display the report data in rows and columns, and allows us to organize the data in
aggregated groups.
It also allows us to add drill down features to get into details of a report.
Tablix = Table + Matrix.
So essentially it allows to add pivot like features to our SSRS reports.

Let’s take an example.

Step 1. Create a blank report


Step 2. Add a connection to the Adventure works database
Step 3. Create a dataset with the following query:

SELECT Sales.SalesTerritory.Name as Region,


Sales.SalesTerritory.CountryRegionCode,
Sales.SalesTerritory.[Group] as Territory,
Year(Sales.SalesOrderHeader.DueDate) as Year,
Month(Sales.SalesOrderHeader.DueDate) as Month,
Sales.SalesOrderHeader.TotalDue
FROM Sales.SalesTerritory
INNER JOIN Sales.SalesOrderHeader
ON Sales.SalesTerritory.TerritoryID = Sales.SalesOrderHeader.TerritoryID

Step 4: Drag and drop the Matrix control from the ToolBox.
Step 5: Drag and drop the territory to the rows and Year to the column:

Step 6: ON clicking Preview, you should be able to get something like this:

Step 7: However the report, does not have any aggregated data.
So let’s drag and drop the TotalDue field to the 'Data' area in the report.
Step 8: On clicking preview, you should be able to see the aggregated report as below:

Go ahead and add some currency formatting to the data.

Let’s look at groupings and drilldowns in the next tutorial.


Lesson 16: Drilldown Matrix Reports
In the last tutorial, we saw how to create a matrix report.
Matrix reports are very useful, and it allows total flexibility too.
For instance we could easily convert a matrix report to tabular.

In this tutorial, let’s see how to add the drill down feature to an existing matrix report.
Let’s take the same matrix report, which we created in the last tutorial.

This is how it looked:

Let’s add some child groupings to this report, and explore some visibility toggling features.

Step 1: Right click on the Territory field and add a child group:
Step 2: Choose 'CountryRegionCode' to group by:

Step 3: Your design view would look something like this:

Step 4: Hit preview.


Congratulations - your matrix report is ready.

Let’s proceed to see some visibility toggling features

Step 5: Click on the row groups - 'CountryRegionRegion' and select the group properties:
Step 6: In the visibility pane, check 'Hide' for ‘when the report is initially run'
also, check the 'display can be toggled by this report item' for Territory

Step 7: Select OK and hit preview.


You should be able to toggle the report.
Lesson 17: SSRS Subreports

SSRS Subreports are extremely helpful, when we need to embed multiple reports in a single report.
The main report serves as a container for multiple sub-reports.
SSRS gives us complete control over what parameters to be passed to the sub report.
Many times this is useful in matrix reports too.

Let’s look at an example of a sub-report.

We are going to create a main report with 1 parameter.


As soon as someone selects a parameter, relevant data is displayed + the sub report is also filtered and
displayed in the main report itself.

Step 1: Create a main report (Steps to create a basic report can be found in the previous tutorials)
I have the following dataset:

SELECT [TerritoryID]
,[Name]
,[CountryRegionCode]
,[Group]
,[SalesYTD]
,[SalesLastYear]
,[CostYTD]
,[CostLastYear]
,[rowguid]
,[ModifiedDate]
FROM [AdventureWorks].[Sales].[SalesTerritory]
Where CountryRegionCode = @CRC

Step 2: Create a parameter called CRC.


Step 3: Your Main report would look something like this.
Step 4: Now let’s add a sub-report and pass in the same parameter to it.
Drag and drop a sub-report control from the toolbox.

Step 5: Now click on the sub-report properties.


Step 6: Let’s us the previous tablix report that we created as our sub-report.

Step 7:
Choose the parameters tab, and configure the parameters
Step 8: click OK and hit preview.
You should be able to see the main and the sub-report.
Lesson 18: Managing SSRS Security

As soon as you install SSRS 2008 R2, in your server and hit http:///reports, by default the the system
administrators get access to the report manager.
But if you wish to let other people see the reports that you deploy, you need to explicitly provide access
to these reports.
Providing access to reports is very simple and can be done at an item level (report level) or a folder level.

Let’s look at a very simple example.


I have installed a SSRS 2008 R2 report server, on my local machine and have created a folder called
Sandbox, in which i have added a report called Hello World.

By Default all admins in the system can access this report.


Let’s say, we add more reports to this folder and we need to grant access to these reports.
This can be done, by clicking on Folder Settings and then clicking on security
Click on New role assignment.
This is the place where you define your role assignments.

If you need to grant all users of your domain access, then you may need to add 'Domain\DomainUSERS'
and assign appropriate roles.
There are mainly 5 types of roles that you can assign to a user or a group.
These roles are:
a. Browser
b. Content Manager
C. My Reports
d. Publisher
e. Report Builder.

Descriptions for each of these roles are provided in the UI itself.

If you wish to add just a particular user of your domain for your report, type the username and select
the appropriate role for the same.

Click OK, and your security is set.


Lesson 20: SSRS Charts and Graphs

SSRS 2008R2 provides a rich set of visualization tools. Some of them are charts / graphs. These are
available in 3D formats to add a rich effects to your reports.

SSRS charts and graphs helps to summarize the data in visual format. It enables to represent very large
datasets as aggregated information available at a glance.
SSRS 2008 R2 also added sparklines to the visualization tools.
In addition, SSRS 2008 R2 also supports guages/Databasrs/Sparkline/Indicators.

One of the most exciting features of SSRS being, usage of Maps.


It allows an awesome representation of Geagraphic data using maps.

Let’s look at some basic graphs and shapes.

Step 1:
As usual, let’s create a blank report, connecting to adventure works database with dataset:

SELECT Sales.SalesTerritory.Name as Region,


Sales.SalesTerritory.CountryRegionCode,
Sales.SalesTerritory.[Group] as Territory,
Year(Sales.SalesOrderHeader.DueDate) as Year,
Month(Sales.SalesOrderHeader.DueDate) as Month,
Sales.SalesOrderHeader.TotalDue
FROM Sales.SalesTerritory
INNER JOIN Sales.SalesOrderHeader
ON Sales.SalesTerritory.TerritoryID = Sales.SalesOrderHeader.TerritoryID
Step 2:
Now let’s drag and drop a chart control from the toolbox.
As soon as you do that, you get a pop-up, displaying various image shapes for the chart control.

Step 3: These are the set of shapes provided by SSRS for visualization purposes.
Choose the first shape.
You should be getting something like this on your screen:
Step 4: This is a blank chart, with no data in it.
You can click on the headings/text in the axis and change accordingly.
Alternatively, you can also write SSRS expressions to change text/descriptions dynamically.
Please refer my previous tutorial, on SSRS expressions.

Step 5: In the above example, i have changed the chart title to 'My First Chart'
Now drag and drop TotalDue to the summation of values, CountryRegionCode to the CategoryGroups
and year to the series Groups.
Something like this...
Step 6: Hit Preview, and you be getting something like this:
Lesson 21: SSRS 2008 R2 Document Maps

A document map in an SSRS report, provides pointers/links to certain report items in your report.
If you have a document map in your report, it will appear in the left most pane. Clicking on any of the
links, in the document pane, jumps the users directly to the report item.
It is similar to the table of contents.
Please note that clicking on the document map links, refreshes the report.

Let’s look at an example for a document map.

Step 1: Create a blank report by connecting to Adventure works database.


I have used the following query to create my dataset:

SELECT Sales.SalesTerritory.Name as Region,


Sales.SalesTerritory.CountryRegionCode,
Sales.SalesTerritory.[Group] as Territory,
Year(Sales.SalesOrderHeader.DueDate) as Year,
Month(Sales.SalesOrderHeader.DueDate) as Month,
Sales.SalesOrderHeader.TotalDue
FROM Sales.SalesTerritory
INNER JOIN Sales.SalesOrderHeader
ON Sales.SalesTerritory.TerritoryID = Sales.SalesOrderHeader.TerritoryID
Order by Sales.SalesTerritory.CountryRegionCode

Your design view after creating the report should look something like this.
Please observe the Row groups.
Adding Territory as a group is necessary here, else SSRS will repeat the Territory values in the document
map.
You can hide one of the territory column (the non-group one) in the report.

Next, goto the Territory column, and select the properties.


Go ahead and choose Territory in the DocumentMaps Property:

Now hit preview, and you should be able to see the follow SSRS 2008 R2 report with a document map:

Select any one Territory in the document map, and the report will jump to the appropriate page.
Lesson 22: SSRS report execution and performance enhancements

SSRS 2008 R2 allows us to execute reports in 3 modes:

1. On Demand.
2. From Cache
3. From Snapshots

On demand:
This is normal approach that we follow, by hitting a report server URL. Each time a report is run, data is
returned from the database server and rendered to the report.
This approach ensures that our report is update and fresh.
The downside of this approach is that, if n users open up this report on their browsers, queries on the
report are executed n times.
Thus this approach at times might slow down the server.

Cache
one of the performance enhancements techniques is to cache a report when it is initially run.
This means that if another user requests for the report, the same report is served to the user from the
cache
this avoids people querying the database server from each report rendering.
To make sure that people do not receive too much stale data, we can set a time to invalidate a cache.
This is a good performance enhancement technique for slow running reports.

Snapshots:
Report snapshots are created at a particular schedule for certain parameters.
Please note that parameters cannot be changes on snapshot reports.
SSRS 2008 R2 allows to schedule the snapshot creation times.
Users can directly render a report from a snapshot. However please note that not all reports can have
snapshots, especially the ones that prompt users for credentials.

You might also like