February 28, 2013 at 2:52 pm
Hi all,
Trying to get data by month for current month and previous month in ssrs but couldn't able to get it. I was using this statement in procedure:
IF @CurrentDate IS NULL
BEGIN
SET @CurrentDate = DATEADD(MM, -1, GETDATE())
END
This gives me records up to Jan and not for Feb month. I want also Feb month in there. How should I write this. Hope this makes sense.
Thanks
February 28, 2013 at 2:54 pm
Grass (2/28/2013)
Hi all,Trying to get data by month for current month and previous month in ssrs but couldn't able to get it. I was using this statement in procedure:
IF @CurrentDate IS NULL
BEGIN
SET @CurrentDate = DATEADD(MM, -1, GETDATE())
END
This gives me records up to Jan and not for Feb month. I want also Feb month in there. How should I write this. Hope this makes sense.
Thanks
How are you using the variable @CurrentDate? It would help to see the actual query involved.
February 28, 2013 at 3:21 pm
@CurrentDate in the procedure is as a parameter and Set to NULL. So in the SSRS report the user will not enter the date. Only input the other information and the report should pull the data for past months including the current month as well. So far if I use the logic mentioned above works to return up to Jan month.
Thanks
February 28, 2013 at 3:23 pm
Can't see from here what you see there. There really isn't enough information to help you unless all you want are shots in the dark.
February 28, 2013 at 3:30 pm
I'll take a shot in the dark. You're setting the current date to last month. Try setting it to this month.
DATEADD(mm,0,getdate())
February 28, 2013 at 10:46 pm
I tried DATEADD(mm,0,Getdate()) also and the current month but didn't get the previous month. Need previous months and current together.
March 1, 2013 at 6:51 am
Without seeing the code we can't give you the answers you want. It is a black box and all we can do is shoot in the dark.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply