Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Current date data problem in SSRS Expand / Collapse
Author
Message
Posted Thursday, February 28, 2013 2:52 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, May 15, 2014 5:59 AM
Points: 45, Visits: 342
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
Post #1425290
Posted Thursday, February 28, 2013 2:54 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 1:59 PM
Points: 23,002, Visits: 31,490
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.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1425292
Posted Thursday, February 28, 2013 3:21 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, May 15, 2014 5:59 AM
Points: 45, Visits: 342
@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
Post #1425299
Posted Thursday, February 28, 2013 3:23 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 1:59 PM
Points: 23,002, Visits: 31,490
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.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1425303
Posted Thursday, February 28, 2013 3:30 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Friday, July 18, 2014 3:36 PM
Points: 541, Visits: 1,044
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())
Post #1425307
Posted Thursday, February 28, 2013 10:46 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, May 15, 2014 5:59 AM
Points: 45, Visits: 342
I tried DATEADD(mm,0,Getdate()) also and the current month but didn't get the previous month. Need previous months and current together.
Post #1425350
Posted Friday, March 1, 2013 6:51 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 1:59 PM
Points: 23,002, Visits: 31,490
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.




Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1425482
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse