Link to home
Start Free TrialLog in
Avatar of LeLeBrown
LeLeBrown

asked on

SSRS DateAdd function

I have a report with two parameters input by the user. One is the End Date and the other is the number of days. In my report heading, I need to calculate the time period. The report will list 6 periods. I need to calculate the dates for the report header. The current period will be something like this 12/04/2014-12/31/2014. The period before that 11/06/2014-12/03/2014 etc... In access I use the below for the period before the current.

L5.Caption = Format([Forms]![frmSRSReport]![txtEndDate] + 1 - (2 * [Forms]![frmSRSReport]![txtDays]), "mm/dd/yy") & " - " & Format([Forms]![frmSRSReport]![txtEndDate] - 1 * [Forms]![frmSRSReport]![txtDays], "mm/dd/yy")

I have tried using the below in an SSRS expression but it give me an error. I have also tried using DateAdd. I think it is having a problem with multiple calculations against the date  - like +1 - (2* SubtractDays). How can I do this in SSRS?

=Format(Parameters!EndDate.Value + 1 - (2 * Parameters!SubtractDays.Value), "mm/dd/yy") & " - " & Format(Parameters!EndDate.Value - 1 * Parameters!SubtractDays.Value, "mm/dd/yy")

Thanks
ASKER CERTIFIED SOLUTION
Avatar of irudyk
irudyk
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LeLeBrown
LeLeBrown

ASKER

Thanks! That worked.
Good to hear :)