Previous month in parameter

I need to set a hidden default parameter in SSRS.

In my query, I don't need to show the last months just a month before, that is, in February, I need to show the total Dec. values.

I've usually been using this for the past month, but can't set it up a month before.

Set the first date of the last month:

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

      

Set the last date of the last month:

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

      

+3


source to share


2 answers


If I understand you correctly, you want:

Get the first day in two months

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

      



And you want to get the last day of the month two months later

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

      

+5


source


Depending on 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 the report:

enter image description here

0


source







All Articles