sql query to create Parameter Hierarchy in SSRS 2008
HI I am using sql server 2008 to execute query.I am working on sql query,which i have to use in SSRS 2008
I have a table and i want the output based on Hierarchy,i have 3 column 'Year''Quarter' and 'Month'
I want to create a SSRS reports from this query,so i need to parameter that i sould have a option to select
Year from Parameter,Ex 2001 or 2002 with a check box,so if could select Year from it.when i select a Year ex 2001 Then i should be able to see all the
Quarter related to it 2001 year,and if a select any Quarter from drop down example Q3 than i should be able to select
Related Months of it like JULY,AUGUST,SEPTEMBER
So how should i create a query with this type of Parameter..i am giving the example of data i have ..
year
Quarter
month
2001
Q1
jan
2001
Q1
feb
2001
Q1
mar
2001
Q2
apr
2001
Q2
may
2001
Q2
jun
2001
Q3
jul
2001
Q3
aug
2001
Q3
sep
2001
Q4
oct
2001
Q4
nov
2001
Q4
dec
2002
Q1
jan
2002
Q1
feb
2002
Q1
mar
2002
Q2
apr
2002
Q2
may
2002
Q2
jun
2002
Q3
jul
2002
Q3
aug
2002
Q3
sep
2002
Q4
oct
what sort of query should i write with the parameter so that i get Year ,quarter ,month as the output in MY SSRS reports based on the the value selected in Parameter....
ON YEAR PAPAMETER IS SHOULD BE ABLE TO SEE 2001,2002,
IF I SELECT ANY YEAR I SHOULD BE ABLE TO SEE ITS RELATED QUARTER LIKE Q1,Q2,Q3,Q4
AND IF I SELECT ANY QUARTER I SHOULD BE ABLE TO SEE ITS MONTH AND ACCORDING TO THIS I SHOULD BE ABLE TO SEE MY qUERY OUTPUT OR OUTPUT IN SSRS...
PLEASE HELP ME
December 15th, 2010 8:47am
Hi,
Generally, in Reporting Services, if available values of a parameter are determined by the value specified to a previous parameter, we can use Cascading Parameters.
For example, we can add 3 cascading parameters in the report based on the dataset you posted. Please refer to the steps below:
1.
Add a dataset
DataSetYear with the query like
SELECT DISTINCT Year
FROM TableName
2.
Add a parameter Year.
Specify its Available Values to the dataset DataSetYear
3.
Add a dataset DataSetQuarter with the query like
SELECT DISTINCT Quarter
FROM TableName
WHERE (Year = @Year)
Associate the query Parameter @Year to the report parameter @Year.
4.
Add a parameter Quarter.
Specify its Available Values to the dataset DataSetQuarter.
5.
Add a dataset DataSetMonth with the query like
SELECT DISTINCT Month
FROM TableName
WHERE (Quarter = @Quarter) AND (Year = @Year)
Associate the query Parameter @Year to the report parameter @Year, the query Parameter @Quarter to the report parameter @Quarter
6.
Add a parameter Month.
Specify its Available Values to the dataset DataSetMonth.
After that, these parameters are cascading and we can refer to them in the report.
For more information about
How to Add Cascading Parameters to a Report, please refer to the link below:
http://msdn.microsoft.com/en-us/library/aa337169(SQL.100).aspx
Thanks,
Tony ChainTony Chain [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Free Windows Admin Tool Kit Click here and download it now
December 20th, 2010 12:06am
Hello,
This is a duplicate of the post:
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/987700d6-5bc8-4441-b9e3-ff38a6756e0f/#dacc4ead-7cf6-4104-935c-7f30a8588537
If you still need a solution for the post, just post your current requirement in the old link itself instaed of opening a new one.Pavan Kokkula Tata Consultancy Services.
December 20th, 2010 12:45am