简体   繁体   中英

Values For Parameters In SSRS

I am using Visual Studio 2012 and SQL Server 2012.

I have created two parameters, StartDate and EndDate, which are both Date/Time parameters.

In my EndDate parameter, I have set the Default Value to Today() in order to get today's date.

For my StartDate parameter, I want it to be based off the EndDate parameter in the following way. Whatever date the user selects as End Date, StartDate will be the date 24 months/2 years prior. (For example, if EndDate was Today (1/11/2017)...then StartDate would be 1/11/2015.)

In the expressions box, this is what I have so far for my default value for StartDate. =DateAdd(DateInterval.Year,-2,Today())

How do I get it, so that every time I change the EndDate, the StartDate updates accordingly to be 2 years prior?

试试这个表达式它将返回1/22/2015

=Date.Now.Date.AddYears(-2).AddDays(10)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM