Site sponsored by: Idera The gold standard of SQL Server performance monitoring & diagnostics.
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Recover Data Using Database Snapshots
Analyze and Fix Index Fragmentation in SQL Server 2008
Powerful Geographical Visualisations made easy with SQL 2008 Spatial (Part 2) ...
Backup User Databases Using a Maintenance Plan

More     
 
Latest FAQ's

How to alter a User Defined Data Type?
How to unzip a File in SSIS?
How to view previous query plans?
ALTER TABLE SWITCH statement failed because the object '%.*ls' is not ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Doc 2008
ApexSQL Enforce
Embarcadero Change Manager
SQL Server DBA Dashboard

More     

articles >> business intelligence >> Same Report but Different Methods in SQL ...

Same Report but Different Methods in SQL Server Reporting Services

By : Dinesh Asanka
Mar 12, 2008

Page 3 / 3


Method 2 : Same Report Different Objects
Rather than having three sub-reports we can do this in one report.

We can include three datasets in the report. We can include three matrices and three charts. We can set the initial visibility option from an expression.  For example, for the color option you can set the visibility expression like=IIF(Parameters!Type.Value="Color",False,True)

The issue with this report is the more controls used in the report the greater the complexity.

Method 3 : Same Report Using Switch
Having seen a method with four reports and another method with six controls, we would like to see a method with less controls and less reports.

There is a command called Switch in SSRS. We can write a query which comprises of all the columns we need.

SELECT
    YEAR(SOH.OrderDate) Year
    ,PSC.Name
    ,CASE
          WHEN Class IS NULL THEN 'N'
          ELSE Class
     END class
    ,Color
    ,SOD.LineTotal
FROM   Sales.SalesOrderDetail SOD
INNER JOIN   production.product PROD
  ON   SOD.Productid = PROD.ProductID
INNER JOIN   Sales.SalesOrderHeader SOH
  ON   SOH.SalesOrderID = SOD.SalesOrderID
INNER JOIN   Production.productsubcategory PSC
  ON   PSC.ProductSubCategoryID = PROD.ProductSubCategoryID


After creating this data set, drag two controls, a matrix and a chart to the report. The Linetotal field needs to be draged and droped in the detail box. The year column should be attached to the column header. Question will be what are we going to attached to rows because row will depend on the user's selection. In this we can use SWITCH command. So for the row you can enter following expression.

=SWITCH(
Parameters!Type.Value ="Class",Fields!class.Value,
Parameters!Type.Value ="SubCategory",Fields!Name.Value ,
Parameters!Type.Value ="Color",Fields!Color.Value )

You can see that depends on the selection, filed value is change. Apart from this we need to change the grouping of the matrix. It is nothing but same above expression. You have to enter above expression for the row grouping.

For the graphs,  you need to have the same expression for series. That is all you need to complete the report. From this method we have only one report with two controls. So this will be the easiest way of developing a report.

Sample
If you need the sample for this article examples, please send me an email to dineshasanka@dbfriend.net and I would like to send the reports to the people who request it.

 


<< Prev Page         








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved