Tuesday, April 24, 2012
The difference between drill down and drill through reports.
During the design of reports and dashboards I have seen that a lot of people do not know the difference between drill down and drill through reports. In most situations people uses the term: Drill down for both situations. However, there is a difference between these reports.
Drill through reports:
A drill through report allows you to go from summary to detail. For instance: You have a financial application in which you can show the balance and profit and loss for a specific time frame. Every general ledger displays the total amount of all transactions for this specific period. By clicking (Drill through) on one of the general ledgers you will see the underlying transactions for this specific period.
Drill down reports:
A drill down reports allows you to look to the data in different levels. For instance, a report displays information on Country level if we drill down the report displays information on state level. Next drill down will display information on city level. So Countries contains States, States contains Cities. So we can view all levels through drill down.
Another examples is Year contains Months, Months contains Weeks, Weeks contains Days, Days contains Hours, Hours contains Minutes.
Picture: My drill down from the Kawarau Bridge, New Zealand Dec 2011
Labels:
drill down,
drill through,
drilldown,
rendering reports,
SQL 2008 R2,
SSRS
Thursday, April 19, 2012
How to display a multi value parameter in a text box in SSRS.
In my previous blog I described how you can pass a multi-value parameter to another SSRS report via drill through. After doing this, sometimes you want to show the used multi-value parameters in a text box. The solution for this is very simple. This can be achieved by using the JOIN function. I will explain with an example @Hostname as multi-value parameter.
Open the text box and define next expression:
="My own text: " + Join(Parameters!Hostname.Label,", ")
Other blog post about multi-value parameters: How to pass NULL value to a multi-value parameter in SSRS?
Picture: Milford Sound, New Zealand Dec 2011.
Labels:
multi-value,
parameter,
SQL 2008 R2,
sql 2012,
SSRS
Tuesday, April 10, 2012
Passing Multi-value parameter to drill through SSRS report.
Last week I was building Report A with a multi value parameter called @Hostname. The values selected for the @Hostname parameter should be passed to Report B with the same multi value parameter. This failed because the dataset expects a valid IN clause. I will explain what happens with an example:
Multi value Parameter: @Hostname
Dataset: Select col1, col2 col3 FROM TableX WHERE Col4 IN (@Hostname)
In this case reporting server tries to add multi values like:
Select col1, col2 col3 FROM TableX WHERE Col4 IN (Server1,Server2,Server3)
This query syntaxt is wrong. It should be
Select col1, col2 col3 FROM TableX WHERE Col4 IN ('Server1','Server2','Server3')
This can be achieved by using next expression in the action for the parameter field:
=SPLIT(JOIN(Parameters!Hostname.Value,","),",")
With this expression the correct TSql syntax will be generated.
Happy building your reports. Enjoy It.
Picture: Mount Cook, New Zealand Dec 2011.
Labels:
multi-value,
parameter,
SQL 2008 R2,
SSRS
Wednesday, March 14, 2012
How to pass NULL value to a Multi value parameter in SSRS?
This week I tried to build a SSRS report with a parameter which can have multiple values including the NULL value. This is not possible by default in SSRS. When you configure the parameter with option: Allow null value and Allow multiple values. You will receive next error message:
A multi-value parameter cannot include null values.
The reason for this is the TSql syntax of the underlying dataset.
SELECT Column1, Column3
FROM TableX
WHERE Column2 IN (@MyParameter)
This query will fail for the NULL value because IN syntax is in conflict with NULL value. TSql syntax for NULL values is
SELECT Column1, Column3
FROM TableX
WHERE Column2 IS NULL
Solution:
We are going to use the ISNULL function to change parameter values to a blank value (''). Assume you have a dataset to retrieve parameter values for @MyParameter.
SELECT DISTINCT(Col1) FROM TableB
Change this query to:
SELECT DISTINCT ISNULL(Col1, '') AS Col1, ISNULL(Col1, 'NULL') AS Col1Description
FROM TableB
Change the Report Parameter Properties to: Allow blank values ('') and Allow multiple values.
Change the available values: Value field: Col1 , Label field: Col1Description.
Now we need to change the query of the dataset.
-- Original query
SELECT Column1, Column3
FROM TableX
WHERE Column2 IN (@MyParameter)
-- Changed query
SELECT Column1, Column3
FROM TableX
WHERE ISNULL(Column2,'') IN (@MyParameter)
That's all, enjoy it to make your report more user friendly.
Labels:
include,
multi-value,
null,
parameter,
sql,
SQL 2008 R2,
SSRS
Subscribe to:
Posts (Atom)

