Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server Newbies
»
Current date data problem in SSRS
Current date data problem in SSRS
Rate Topic
Display Mode
Topic Options
Author
Message
Grass
Grass
Posted Thursday, February 28, 2013 2:52 PM
SSC Rookie
Group: General Forum Members
Last Login: 2 days ago @ 12:37 PM
Points: 42,
Visits: 325
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
Lynn Pettis
Lynn Pettis
Posted Thursday, February 28, 2013 2:54 PM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 11:07 PM
Points: 21,589,
Visits: 27,394
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
Grass
Grass
Posted Thursday, February 28, 2013 3:21 PM
SSC Rookie
Group: General Forum Members
Last Login: 2 days ago @ 12:37 PM
Points: 42,
Visits: 325
@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
Lynn Pettis
Lynn Pettis
Posted Thursday, February 28, 2013 3:23 PM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 11:07 PM
Points: 21,589,
Visits: 27,394
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
Erin Ramsay
Erin Ramsay
Posted Thursday, February 28, 2013 3:30 PM
SSC-Addicted
Group: General Forum Members
Last Login: 2 days ago @ 1:44 PM
Points: 419,
Visits: 773
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
Grass
Grass
Posted Thursday, February 28, 2013 10:46 PM
SSC Rookie
Group: General Forum Members
Last Login: 2 days ago @ 12:37 PM
Points: 42,
Visits: 325
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
Lynn Pettis
Lynn Pettis
Posted Friday, March 01, 2013 6:51 AM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 11:07 PM
Points: 21,589,
Visits: 27,394
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 »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.