in SSRS,  @Month populates @StartDate and @EndDate, how to hidde @StartDate and @EndDate

tanj1035
tanj1035 used Ask the Experts™
on
Hi, in the report, I have created
1)@Month,
Dataset query:
select  MonthName FROM [MMD_Feed].[dbo].[Calendar]
  where  datepart(yyyy,getdate())=left(EndDate,4)
order by MonthNumber asc

2)@StartDate
Dataset query:
select StartDate  FROM [MMD_Feed].[dbo].[Calendar]
where  MonthName= @MonthName and datepart(yyyy,getdate())=left(EndDate,4)

3)@EndDate
Date query:
select EndDate  FROM [MMD_Feed].[dbo].[Calendar]
where  MonthName= @MonthName and datepart(yyyy,getdate())=left(EndDate,4)

What I want:
in the report, the end user can  see @Month only, so @StartDate and @EndDate will be hidden. When the end user select @Month = March for example, @Month will populate @StartDate = 2015-02-1 and @EndDate = 2015-03-31. In the report, all the tables will show the data from 2015-02-1 to 2015-03-31.

My problem:

I had to make @Month, @StartDate and @EndDate visible in the report parameter setting, so the report can run correctly.
If I configure @StartDate and @EndDate to hidden or internal, the report shows the error message " the 'StartDate'Parameter is missing a value"

So How Can I hide @StartDate and @EndDate to make the report run correctly?

Thank you in advance!
Capture.JPG
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017

Commented:
What is the data in the report, you can use the start and end dates in the where clause, but you are not required to include them in the select
Commented:
Thanks, Arnold. In my report, the dataset of each table contains @startdate and @enddate in where clause already.
I worked it out and want to share with everyone.
In @StartDate and @EndDate parameter setting:
in general : choose hidden
in default value: choose get value from query
"select StartDate  FROM [MMD_Feed].[dbo].[Calendar]
 where  MonthName= @MonthName and datepart(yyyy,getdate())=left(EndDate,4)"

So the @StartDate and @EndDate are hidden but still can pass the value to the tables.

Thanks!!

Author

Commented:
I figured it out.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial