简体   繁体   中英

SSRS Date Time Parameter

在此处输入图片说明 I have an SSRS report that I would like to set the default end date to be 6 months prior to today's date and the start date to be 2 years prior to the end date. If I run it in September, End date would be March, next month End date should automatically update to April. How can I configure this in SSRS?

Create the parameters, and set the Default values as below:

Start Date: =DateAdd(DateInterval.Month, -30, Today()))

End Date: =DateAdd(DateInterval.Month, -6, Today()))

Use these parameter values in the data set queries to filter out the results.

Try this:

Start Date: =DateAdd(m, -30, GetDate())

End Date: =DateAdd(m, -6, GetDate())

Here are great references:

SQL Server DATEADD() Function

SQL Date Functions

The below expression will work as per your need, you need to put these in the parameters default value section and opt for "specify values" -

StartDate =DateAdd(DateInterval.Month,-30,Now())

EndDate =DateAdd(DateInterval.Month,-6,NOW())

Also choose the parameters as Date/Time . Below Snapshot to show the difference I chose Start Date as Date/Time and End Date as Text 在此处输入图片说明

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