amolacp (8/25/2014)
Hello All,I'm having an issue with adding parameters to the report with the below statement. When I add @Start as a parameter in report and set the default value to =DATEADD( "M", -1, DATEADD("QQ", DATEDIFF("QQ", 0, Today()),0)), I get an error saying - An error occured during local report processing. How can I set default @Start date to the below value? I also have to set the default value for @End to - DATEADD(day, -1, DATEADD(month, DateDiff(month, 0, @Start) +1, 0))? Thanks
declare @Start as date
declare @End as date
declare @NextStart as date
Declare @NextEnd as date
Set @Start= DATEADD( MM, -1, DATEADD(QQ, DATEDIFF(QQ, 0, GETDATE()),0))
Set @End = DATEADD(day, -1, DATEADD(month, DateDiff(month, 0, @Start) +1, 0))
Set @NextStart = DATEADD(MONTH, 1, @Start)
Set @NextEnd = DATEADD(day, -1, DATEADD(month, DateDiff(month, 0, @Start) +2, 0))
Thanks,
Below is the SSRS equivalent expression for start.
DATEADD(DateInterval.Month,-1,DATEADD(DateInterval.Quarter,DATEDIFF(DateInterval.Quarter,CDate("1900-01-01"),CDate("2014-08-25")),Cdate("1900-01-01")))
This how it works
QQ = DateInterval.Quarter
When you are passing 0 in the DATEDIFF it is eqivalent to 1900-01-01
IN SSM try the below code
declare @d1 datetime = 0
select @d1
I hope you can make it other parameters