Professional Documents
Culture Documents
SSRS 2012 Material
SSRS 2012 Material
Report Server: - Report Server is the core engine that drives Reporting Services. The URL for Report
server is, http://servername/reportserver
Report Manager: - Report Manager is a Web-based administrative interface for Reporting Services.
The URL for Report Manager is, http://servername/reports
Note: - The content of Report Server is same as Report Manager.
Report Designer: - Report Designer is a developer tool for building complex reports. 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 (Business
Intelligence Development Studio).
Report Builder: - 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 (.smdl) before end users can create reports.
Page
1
Rama Rao
2.
3.
4.
5.
Name the new report MorningBatch and pick a convenient location to save it in.
6.
Right-click on the Reports node in Solution Explorer (Ctrl+Alt+l) and select Add New
Item.
7.
8.
9.
NameDSrcProductDetails
b.
c.
Click Edit
d.
ii.
iii.
Click Ok
11. Click Ok
12. In the Report Data window, select DSrcProductInformation Right and select Add
Dataset.
13. In Dataset Properties Editor, Provide the following information,
a.
Name dsProducts
b.
c.
Query Type Select or Check Text Radio Button to the dataset from SQL Script
d.
Query Click Query Designer to build the query or build the query on SQL Server
Management Studio,
e.
f.
g.
h.
Select the following columns or fields from the above mentioned tables,
Page
2
Rama Rao
Production.ProductCategory.ProductCategoryID, Production.ProductCategory.Name AS
CategoryName, Production.ProductSubcategory.ProductSubcategoryID,
Production.ProductSubcategory.Name AS SubcategoryName,
Production.Product.ProductID, Production.Product.Name, Production.Product.Color,
Production.Product.ReorderPoint, Production.Product.StandardCost,
Production.Product.ListPrice, Production.Product.Size, Production.Product.Weight,
Production.Product.Class, Production.Product.Style, Production.Product.SellStartDate
i.
j.
Click Ok
Finally, the dataset (dsProducts) query is generated as mentioned below,
SELECT
Production.ProductCategory.ProductCategoryID,
Production.ProductCategory.Name AS CategoryName,
Production.ProductSubcategory.ProductSubcategoryID,
Production.ProductSubcategory.Name AS SubcategoryName,
Production.Product.ProductID, Production.Product.Name, Production.Product.Color,
Production.Product.ReorderPoint, Production.Product.StandardCost,
Production.Product.ListPrice, Production.Product.Size, Production.Product.Weight,
Production.Product.Class, Production.Product.Style, Production.Product.SellStartDate
FROM
Production.Product INNER JOIN
Production.ProductSubcategory ON
Production.Product.ProductSubcategoryID =
Production.ProductSubcategory.ProductSubcategoryID INNER JOIN
Production.ProductCategory ON Production.ProductSubcategory.ProductCategoryID =
Production.ProductCategory.ProductCategoryID
14. Click Refresh fields and Click Ok. Finally, the datasource and dataset looks like,
Page
3
Rama Rao
Page
4
Rama Rao
20. Select the Preview tab to see the report with data.
Page
5
Rama Rao
Parameterized Reports
parameterized report uses input values to complete report or data processing. With a
parameterized report, you can vary the output of a report based on values that are set when the
report runs. Parameterized reports are frequently used for drill-through reports, linked reports,
and sub-reports, connecting and filtering reports with related data.
A
In our previous/above mentioned dataset (dsProducts), add the following where clause at
the end of the query,
WHERE
Production.ProductCategory.ProductCategoryID = @ProductCategoryID
4.
In the Report Data window, select DSrcProductInformation Right and select Add
Dataset.
In Dataset Properties Editor, Provide the following information,
a.
Name dsProductCategoryIDName
b.
c.
Query Type Select or Check Text Radio Button to the dataset from SQL Script
d.
Query Click Query Designer to build the query or build the query on SQL Server
Management Studio,
Provide the following query to build the dataset for CategoryID and Name
SELECT
FROM
5.
6.
parameter
In Report Parameter Properties Editor,
Select Available Values Check Get Values from Query Radio
button
8. And, Set, DatasetSelect dsProductCategoryIDName
7.
Page
6
Rama Rao
In our previous/above mentioned dataset (dsProducts), add the following where clause at
the end of the query,
WHERE Production.ProductCategory.ProductCategoryID IN
(@ProductCategoryID))
Note:- Here, @ProductCategoryID is a parameter
2.
3.
In the Report Data window, Expand Parameters Select ProductCategoryID Right and
select Parameter Properties option.
In Report Parameters Wizard, set the following setting,
In General Page, Check Allow multiple Values check box
4.
5.
Chart Report:
Chart report is used to display the to present data graphically as bars, pies, column and other
chart types
2.
3.
4.
Page
7
Rama Rao
5.
6.
7.
Select SellStartDate field from Category section Right Click Select Category Group
Properties
8.
=Left(MonthName(Month(Fields!SellStartDate.Value)),3) &"-"&
Right(Year(Fields!SellStartDate.Value),2)
9.
Click Ok
In the above mentioned column report, Select Series Right Click and Select Show Data
Labels option
Page
8
Rama Rao
In the above mentioned column report, Select Series Right Click and Select Series
Properties option
2.
3.
4.
Click Ok
Legend
Major and Minor Tick Lines
Scale Properties and etc.
Rectangle
Rectangle report item is a container for other report items. If we set any property to this rectangle
container, then that applicable to all the report items on it.
Note:- Rectangle can be placed either in Header or Footer Section of the report.
In our previous/above report example, Add/drag and drop Rectangle Report Item
Page
9
Rama Rao
2.
3.
4.
Drag and drop the already Designed Table report on RectTable named rectangle
5.
6.
7.
8.
Drag and drop the already Designed Chart report on RectChart named rectangle
Scenario: - Display table report (First report) item in Sheet 1/Page 1 and Chart report
item (Second Report) in Sheet 2/Page 2, when we export it excel or PDF.
1.
2.
And, Check Add a Page Break After Checkbox. In order to maintain page breaks
between recttable and rectchar rectangles
3.
4.
5.
Page
10
Rama Rao
a.
b.
5. In Action Page Check Go to URL radio button Provide the follow URL,
http://www.vijayit.com
6. Click Ok
Text Box: Text box report is used to display labels or fields or values from expressions.
Scenario: - Display Page numbers in each and every page of the report in the following format, Page
1 of 10.
In the above designed report example, Select Report Select Add Page Footer to add footer
of page.
2.
In Tool Box Drag and drop Text box on Page Footer section
3.
4.
5.
Click ok
List Report Item:- List report item is used to display a set of report items that are repeated for
each group or row of data.
In the above mentioned report item remove Add Page Break at End option for the
RectTable rectangle and keep multi-value option as it is.
2.
3.
4.
Click Ok
5.
Select Tablix Row Right click Select Row Group Select Group Properties
6.
Page
11
Rama Rao
7.
Click Ok
8.
Place the report items that you would like to repeat for each and every group on above
configured list report.
9.
Preview Report
Groups Or Drilldown reports: Drilldown reports initially hide complexity and enable the user to toggle
conditionally hidden report items to control how much detail data they want to see. Best example of
Drilldown report is Sale information for the Year, then drill down for Quarters followed by Months and week.
Other example is Sale by Region then drilldown by Countries followed by State and Cities.
In Report Designer (BIDS), Groups are created to organize data on the report or to calculate aggregate summaries.
An understanding how to define groups and use group features helps you design reports that are more concise and
communicate summarized data in a more compact format.
We also use Groups in SSRS reports to provide Drill-down features.
1.
Page
12
Rama Rao
2.
3.
4.
Drag and drop a table control and select CustomerName, OrderNumber, and SalesAmount fields in the
table.
5. Select table detail row --> Right click --> select Add Group --> Row Group --> Parent Group
Page
13
Rama Rao
6. Select ProductName in Tablix group window and check add group header check box. Click OK and sace
changes.
Now you can see Product Group in the table as shown below:
Delete Group1 Column and rename Customer Name as Particulars. Select ProductName in Product Group as
shown below:
7. Select ProductName group and add one more group for SalesCountry in similar way mentioned at step5. Delete
the group column and select SalesCountry in CountryGroup as shown below:
Page
14
Rama Rao
SalesRegion
Date
Month
Quarter
Year
9. We are done with report Groups. You can Preview the report:
10. Format Groups: This is the final step. Without formatting the tabular data look meaningless and its very
difficult to understand the report. You can do following formatting to make it easier to understand:
Group
Year
2pt
#7c73c8
Quarter
12pt
#9894ca
Month
22pt
#b4b4c8
Date
32pt
#c7c7d8
Page
15
Rama Rao
SalesRegion
42pt
#dadaeb
SalesCountry
52pt
#e7e7f0
ProductName
62pt
#f4f4fc
CustomerName
72pt
(detail row)
White
Toggle Groups:
Select Quarter Group and click on Group Properties. Select Visibility in Group Properties and select Hide option
button. Check Dispaly can be toggled by this report item check box and select Year from combo box.
Page
16
Rama Rao
Drill-through Report
Drillthrough reports are standard reports that are accessed through a hyperlink on a report item in the
original report. Drillthrough reports work with a main report and are the target of a drillthrough action
for a report item such as placeholder text or a chart. The main report displays summary information,
for example in a matrix or chart. Actions defined in the matrix or chart provide drillthrough links to
reports that display greater details based on the aggregate in the main report. Drillthrough reports
can be filtered by parameters.
3.
4.
5.
Name the new report DrillThrough_SalesOrder and pick a convenient location to save it in.
6.
Right-click on the Reports node in Solution Explorer (Ctrl+Alt+l) and select Add New
Item.
7.
8.
9.
Page
17
Rama Rao
a.
NameDSrcSalesOrdersPerProduct
b.
c.
Click Edit
d.
ii.
iii.
Click Ok
11. Click Ok
12. In the Report Data window, select DSrcSalesOrdersPerProduct Right and select Add
Dataset.
13. In Dataset Properties Editor, Provide the following information,
a.
Name dsSalesOrderDetails
b.
c.
Query Type Select or Check Text Radio Button to the dataset from SQL Script
d.
Query Click Query Designer to build the query or build the query on SQL Server
Management Studio,
e.
SELECT
FROM
WHERE
14.
Click Ok
15.
16.
17.
18.
19.
Page
18
Rama Rao
Drillthrough reports: Drillthrough reports are standard reports that are accessed through a
hyperlink on a report item in the original report. Drillthrough reports work with a main report and are
the target of a drill through action for a report item such as placeholder text or a chart. The main
report displays summary information. Drillthrough reports can be filtered by parameters.
1.
Open BIDS
2.
3.
Create a new dataset and rename it as dsProductSubCategory and provide the following
query,
Select c.ProductCategoryID,c.Name as Category,
COUNT(sc.ProductCategoryID) as NoOfSubCategory
from Production.ProductCategory c
inner join Production.ProductSubcategory sc on
sc.ProductCategoryID=c.ProductCategoryID
group by c.ProductCategoryID,c.Name
and Click Apply and Ok
4.
From Toolbox, drag and drop chart report item on to design area, and select Pie chart
report, And set dsProductSubCategory and click ok.
Add =Sum(Fields!NoOfSubCategory.Value)expression on Data Section
And, also add =Fields!Category.Value expression on Series section (at right hand
side)
Page
19
Rama Rao
5.
Click on any Series Right Click Select Show Data Labels option
6.
Open BIDS and Add a new report item and rename it as DetailedReport.rdl
2.
3.
4.
select
sc.ProductCategoryID
,sc.ProductSubcategoryID
,sc.Name
,sc.ModifiedDate
from
Production.ProductSubcategory sc
where sc.ProductCategoryID=@ProductCategoryID
5.
Drag and drop Table report item onto report design area, and bind the
fields from dataset to table report item. And, also apply cosmetics
(like set font size, type etc)
6.
Page
20
Rama Rao
Page
21
Rama Rao
Cascading Report
Dependency of parameters that means one parameter depends on another parameter.
Steps to Configure Cascading Report
1.
2.
3.
SELECT
Page
22
Rama Rao
c.Name as Country
,s.Name as [State]
,a.AddressID,
case
when a.AddressLine1 IS null then a.AddressLine2
when a.AddressLine2 IS NULL then a.AddressLine1
else a.AddressLine1 + ', '+ a.AddressLine2 END as [Address]
,a.City,a.PostalCode
from Person.[Address] a WITH (NOLOCK)
Inner Join Person.StateProvince s WITH (NOLOCK) ON s.StateProvinceID
= a.StateProvinceID
Inner Join Person.CountryRegion c WITH (NOLOCK) ON
c.CountryRegionCode = s.CountryRegionCode
where a.StateProvinceID = @StateProvinceID
6.
7.
Page
23
Rama Rao
8.
In Available Values page, set the following optional/mandatory properties and click Ok
9.
Double Click on StateProvinceID parameter, and set the properties same as above.
Page
24
Rama Rao
10. In Design tab, Design the report layout and Preview the report.
C:\Program
Files
(x86)\Microsoft
Visual
9.0\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject
Studio
Page
25
Rama Rao
On the Report Properties window, click on Subscriptions on the top. This will show you two
options; the first option (New Subscription) lets you create a standard subscription for the
report whereas the second option (New Data-driven Subscription) lets you create a datadriven subscription. I will be talking more about data-driven subscriptions in my next
article.
When you click on the New Subscription link on the page shown above, it will bring up a
page with two parts. In the first part you can define the report delivery method and in the
second part you can specify subscription processing options. The Report Delivery Options
section will change depending on the delivery method you choose. For example as you can
see below, I have chosen a delivery method of E-Mail and hence it has options to specify TO,
CC, BCC, subject line, whether to include the report as link or as an attachment, etc.
Page
26
Rama Rao
If you change the delivery method to Windows File Share, the fields on screen will
change to let you specify the file name, share location, credential to use to copy the file at
that location, overwrite options, etc.
Page
27
Rama Rao
The second part of the screen lets you define the subscription processing options. Broadly
speaking, you can specify two settings here. First you define a schedule for the subscription
to process and second you specify the parameter values to be used during processing of the
reports. Here you can specify to use the default value for a parameter if it has been defined
or you can specify a new value. Please note, if you have set report snapshot for your report,
you can also specify subscription to run from the snapshot whenever the snapshot is
refreshed instead of using a schedule to process the report subscription. Also in this case
parameter values from snapshot will be used and you cannot change it.
When defining a schedule for subscription processing, you can choose to use any predefined
shared schedule (select one from the combo box) or you can use an embedded/dedicated
schedule for this subscription processing. When you click on the Select Schedule button on
Page
28
Rama Rao
the above screen, it will bring up a screen as shown below where you can define a schedule
for daily, weekly, monthly, yearly processing, etc.
Once created, you can view the subscription and its execution details in the subscription
detail page as shown below. You can click on the Edit hyperlink to modify the subscription
or select a subscription and click on the Delete button to delete it.
Page
29
Rama Rao
Report server will generate a report for each enabled subscription on the defined schedule,
for example, in my subscription I have specified file share as the delivery method and
subscription to run every 2 minutes. The result you can see below; notice that each report
has been generated every two minutes.
As I said before, the subscription detail page displays the execution details of the
subscription; notice the Last Run and Status columns below:
There are a couple of points that you need to be aware of when creating subscription for the
reports.
Page
30
Rama Rao
3. Once we select Advanced Mode, Select Static group in Row Groups section and press F4 for
properties, and set the following properties,
Page
31
Rama Rao
Sparkline and data bars Sparkline and data bars are normally used inside tables
and matrices to analyze the trend and series and compare them with each other.
Indicators If you are aware of KPIs, the concept of indicators is not new to you.
As the name implies, indicators have icons to represent trends (up, down or flat),
progress state, conditions.
Maps It allows you to create maps or maps layers to let you visualize data against
a geographic background.
Page
32
Rama Rao
On the design query screen use the following query and click Next:
select
c.Name as Country
,s.Name as State
,a.City,a.PostalCode
,a.SpatialLocation AS Coordinates
from [Person].[Address] a
Inner JOin Person.StateProvince s ON a.StateProvinceID = s.StateProvinceID
Inner Join Person.CountryRegion c ON c.CountryRegionCode = s.CountryRegionCode
where s.Name = 'Alabama'
GO
In the toolbox, click the Map icon and click anywhere on the report design screen and the
New Map Layer box should appear.
Page
33
Rama Rao
In the Map Layer Box there are a few options including Map gallery, ESRI shapefile, or SQL
Server spatial query. The first layer we'll create will be the basic map layer. I'll choose Map
gallery and drilldown states by county and select Alabama.
Click Next where it will display the state of Alabama and it's outlined counties. Here you can
add a Bing Map layer if needed and select a Map resolution. Click Next.
Page
34
Rama Rao
The next screen will display map visualizations. Here you can select Basic Map, Color
Analytical Map, or Bubble Map. For this example, I'll choose Basic Map.
Next screen will let you choose a theme, single color map, and give you the option to
display labels such as county names. Once you are finished customizing your map click
Finish.
Next I usually click on the map and scale it to the size I want for display and change the
Map Title at the top to an appropriate title.
Page
35
Rama Rao
Once you have the map the way you want it you will need to add another layer for the zip
codes. To do this right click on the map and select Add Layer. Our New Map Layer box
should appear again. This time we'll choose SQL Server spatial query and click Next.
Page
36
Rama Rao
Here you will you see your pinpoints that were specified in the database table. You can also
change the layer type if needed. Click Next to choose a map visualization.
Once on the map visualization screen you can choose a Basic MarkerMap, Bubble Map, or
Analytical Map. For this example I'll choose Basic Marker Map because I just want to mark
my zip codes.
Page
37
Rama Rao
The next screen will allow you to choose a Theme, Marker, specify a single/multicolor map
and display labels based on your dataset. I'll choose Generic Theme, PushPin marker, and
display labels based on City. Click Finish.
Once back, you will be in design view, click Preview to preview the report.
Page
38
Rama Rao
Once you're map is the way you like it, right click the .rdl in Solution Explorer and Deploy.
Example # 2:
A map report can be layered where each layer will display a layer of geographical
background.
The types of map layers that can be added to a map report are as follows:
Page
39
Rama Rao
Map Gallery There are some in built reports with map elements, which
you can use as source for spatial information but this is limited to USA
states only as of now.
ESRI shapefiles Environmental Systems Research Institute, Inc. provides
shapefiles, which can be used as source for geographical data or spatial
information.
SQL Server Spatial Data If you have geographical data or spatial
information already stored in SQL Server, you can use it directly. In the next
article, I will demonstrate how you can export ESRI shapefiles to SQL Server
and then use it from SQL Server.
To add a map to your report, drag the Map report item from the Toolbox to the
designer area:
When you drag a Map report item from the Toolbox to the designer area, a wizard
will be launched to specify the map layer detail for the map. On the first page of the
New Map Layer wizard, you need to specify the source for the spatial/geographical
data that contains set of coordinates that define the map areas. As discussed
above, there are three options here, the first Map Gallery is very limited so I will
choose the ESRI Shapefile option for this demonstration, and in the next article on
map report with drilldown I will explore the third option of getting spatial data from
SQL Server query:
Page
40
Rama Rao
Page
41
Rama Rao
Page
42
Rama Rao
Page
43
Rama Rao
Now if you have already data source and data set added to your report, the wizard
will ask you to specify the source for the analytical data. In my case I hadn't
already, created a data source and data set, so I created it now. Then, to specify
the analytical data source for the map layer I need to select the map; from the Map
Layer window I need to select the map layer for which I need to specify the
layer/analytical data and click on the tiny icon on the right most side as shown
below. Then I need to click on Layer Data from the menu bar:
Page
44
Rama Rao
Page
45
Rama Rao
Page
46
Rama Rao
Page
47
Rama Rao
Query results
Thats all, now you can preview the report; you can also change some properties
like label and tooltip, as shown below, to make it look more intuitive:
Rama Rao
bubble size to visualize data" to analyze the data by varying bubble size centered
on areas:
Page
49
Rama Rao
Page
50
Rama Rao
Page
51
Rama Rao
Page
52
Rama Rao
2. In Groups Editor, Click on Row Group Arrow mark, Add Group Parent
Group,
Page
53
Rama Rao
4. Row Group (Group1) has been create as show in the below screen shot,
5. In the Report Layout, Group1 has been created. Right Click on Group1
column Delete Column,
6. In Delete Column window, Select Delete Column only radio button and
click Ok. Now you can see the Group1 column is deleted but Group1 is still
available in the report that groups every 60,000 records,
Properties,
Page
54
Rama Rao
and also
Page
55
Rama Rao
1) Design a report.
2) Add a Group to the column for which you want to configure document map and in this case I
created group for Categories Field as shown below.
3) Right click on group and select group properties as shown below.
Page
56
Rama Rao
Then go to Preview report and you can find the Bookmarks on the left hand side and if you select any
bookmark item then it will take you to the particular item in report. PFB the screenshot showing the
bookmark for the report created.
Page
57
Rama Rao
Page
58