简体   繁体   English

SSRS:基于EndDate参数的StartDate参数的默认值

[英]SSRS: Default Values for StartDate Parameter Based on EndDate Parameter

I'm working with SSRS and using Visual Studio 2012. 我正在使用SSRS并使用Visual Studio 2012。

I have two parameters StartDate and EndDate and I configured default values for each. 我有两个参数StartDate和EndDate,并且为每个参数配置了默认值。

The default values currently for both are the following: 当前两者的默认值如下:

StartDate: =DateAdd("d",-(Day(today)-1), Today)

EndDate: =Today() - 1

I want the values to bring in: StartDate: 1/1/2017 EndDate: 1/31/2017 我希望输入这些值:StartDate:1/1/2017 EndDate:1/31/2017

Basically, I want EndDate to be the previous day (eg EndDate for today would be 1/31/2017 since today is 2/1/2017.) 基本上,我希望EndDate是前一天(例如今天的EndDate将是1/31/2017,因为今天是2/1/2017。)

And then for StartDate, I want that to be the first day of the month that EndDate pulls in (eg since EndDate pulled in 1/31/2017, the StartDate should pull in 1/1/2017.) 然后对于StartDate,我希望它是EndDate进入月份的第一天(例如,由于EndDate进入了1/31/2017,因此StartDate应该进入了1/1/2017。)

However, with the current parameters in place, StartDate pulls in 2/1/2017 and EndDate pulls in 1/31/2017. 但是,在使用当前参数的情况下,StartDate拉入2/1/2017,EndDate拉入1/31/2017。

How do I get StartDate to pull in the 1st day of the month based on the value of EndDate? 如何根据EndDate的值使StartDate进入每月的第一天?

For StartDate you can use: 对于StartDate,您可以使用:

=DateSerial(Today.AddDays(-1).Year,
Today.AddDays(-1).Month,
1)

Let me know if this helps. 让我知道是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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