3

我需要在 SSRS 中设置一个隐藏的默认参数。

在我的查询中,我不需要显示上个月的总计,而是上个月,即在 2 月我需要显示 12 月的总计。

我通常在上个月使用它,但不能在前一个月调整它。

设置上个月的第一个日期:

=DateAdd("m", -1, DateSerial(Year(Now()), Month(Now()), 1))

设置上个月的最后日期:

=DateAdd("d", -1, DateSerial(Year(Now()), Month(Now()), 1))
4

2 回答 2

5

If i understand you right you want to:

Get the first day of two months from now

=DateAdd("m", -2, DateSerial(Year(Now()), Month(Now()), 1))

And you want to get the last day on month two months from now

=DateAdd("d" , -1 , DateAdd("m", -1, DateSerial(Year(Now()), Month(Now()), 1)))
于 2013-02-15T12:43:23.660 回答
0

Depending on exactly what you need, use something like:

DateAdd
(
    DateInterval.Month
    , -1
    , DateAdd(DateInterval.Day, -1, DateSerial(Year(Parameters!Date.Value), Month(Parameters!Date.Value), 1))
)

Used in a report:

enter image description here

于 2013-02-15T12:43:16.753 回答