SSRS 2005 - Change 2nd Parameter Value based on 1st Parameter Value (Non-queried)
I am wanting to filter my report based on Fiscal Year. I have the first parameter as @STARTDATE and 2nd parameter as @ENDDATE. The values for both of these are hardcoded in non queried. When the user selects the @STARTDATE , I want to automatically set the value for the @ENDDATE parameter. I'm doing it this way because I'm using BETWEEEN in my SQL Query. Ideally, I will just have the @ENDDATE value hidden if possible. So for example: @STARTDATE has values of 10/1/2009 and 10/1/2010. @ENDDATE has values of 9/30/2010 and 9/30/2011. When @STARTDATE is selected to 10/1/2009, set the @ENDDATE value to 9/30/2010. When @STARTDATE is selected to 10/1/2010, set the @ENDDATE value to 9/30/2011. Any idea how/if this can be accomplished?
October 7th, 2010 10:00pm

ok so you want end date to be the last of day of the of the previous month in the year after of the startdate? or does it change if the user enters a date in the middle of the month? if you want it to always be the previous month you can set the default value of the enddate parameter to something like this: =dateserial(year(parameters!startdate.value)+1, month(parameters!startdate.value), 0)
Free Windows Admin Tool Kit Click here and download it now
October 7th, 2010 10:52pm

The @STARTDATE and @ENDDATE values are fixed values. They are only able to select 10/1/2009 or 10/1/2010 for the Start date in a drop down box and same for @ENDDATE only allows them to select the 9/30/2010 and 9/30/2011. Although ideally, they would just select the first parameter, Start Date, and the End date would get set automatically behind the scenes.
October 7th, 2010 11:34pm

ok then that expression will still work, just need to convert the startdate value to a date value when calculating the enddate: =dateserial(year(cdate(parameters!startdate.value))+1, month(cdate(parameters!startdate.value)), 0) also set the enddate parameter to "hidden" in the parameter options if you dont want it seen
Free Windows Admin Tool Kit Click here and download it now
October 8th, 2010 1:09am

Place this expression in the default values section for EndDate parameter. =IIF(Parameters!StartDate.Value = "10/1/2010", "9/30/2011", "9/30/2010") Hope its helpful....Pavan Kokkula Infosys Technologies Limited.
October 8th, 2010 6:06am

Both solutions provided =dateserial(year(cdate(parameters!startdate.value))+1, month(cdate(parameters!startdate.value)), 0) =IIF(Parameters!StartDate.Value = "10/1/2010", "9/30/2011", "9/30/2010") set the default values for the first load of the report, but when I change the Start Date value, I still have to change the End Date value. Any way to get around this?
Free Windows Admin Tool Kit Click here and download it now
October 12th, 2010 5:09pm

set the enddate parameter to "hidden", changes to the startdate parameter will cascade down to the enddate parameter
October 12th, 2010 6:54pm

Nehemiah, Below is what I did based on your suggestions and got it to work. The only problem I'm having now is with the default STARTDATE. I have it set to 10/1/2009 and it works in Business Intelligence Studio Preview, but when I upload it to /reports, it doesn't have a default and makes the user pick from the dropdown. Any suggestions? STARTDATE: Data type = DateTime Available Values (non-queried) = 10/1/2009 and 10/1/2010 Default Value (non-queried): 10/1/2009 ENDDATE (Hidden): Data type = DateTime Available Values (non-queried) = =dateserial(year(cdate(parameters!startdate.value))+1, month(cdate(parameters!startdate.value)), 0)Default Value (non-queried): =dateserial(year(cdate(parameters!startdate.value))+1, month(cdate(parameters!startdate.value)), 0) TIA for your help.
Free Windows Admin Tool Kit Click here and download it now
October 12th, 2010 9:15pm

Hi JPL0318, Excellent job, great sharing.
October 13th, 2010 4:52am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics