[英]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.
我有一个SSRS的报告,我想设置默认结束日期为今天的日期和开始日期前6个月之前要结束之日起2年。 If I run it in September, End date would be March, next month End date should automatically update to April.
如果我在9月运行,结束日期将是3月,下个月结束日期应自动更新为4月。 How can I configure this in SSRS?
我怎样才能在SSRS配置呢?
Create the parameters, and set the Default values as below: 创建参数,并设置默认值,如下所示:
Start Date: =DateAdd(DateInterval.Month, -30, Today()))
开始日期:
=DateAdd(DateInterval.Month, -30, Today()))
End Date: =DateAdd(DateInterval.Month, -6, Today()))
结束日期:
=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())
开始日期:
=DateAdd(m, -30, GetDate())
End Date: =DateAdd(m, -6, GetDate())
结束日期:
=DateAdd(m, -6, GetDate())
Here are great references: 这里有很多参考资料:
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())
StartDate
=DateAdd(DateInterval.Month,-30,Now())
EndDate =DateAdd(DateInterval.Month,-6,NOW())
EndDate
=DateAdd(DateInterval.Month,-6,NOW())
Also choose the parameters as Date/Time
. 还要选择参数作为
Date/Time
。 Below Snapshot to show the difference I chose Start Date as Date/Time
and End Date as Text
在“快照”下方以显示差异,我选择“开始日期”作为“
Date/Time
和“结束日期”作为“ Text
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.