Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: First of the Month Reporting Post Reply Post New Topic
Author Message
ecathell
Newbie
Newbie


Joined: 14 Jul 2010
Online Status: Offline
Posts: 2
Quote ecathell Replybullet Topic: First of the Month Reporting
    Posted: 15 Jul 2010 at 2:46am
I have a report that I manually do now. its basically a query against an Access Database:

SELECT Count(Master.MasterID) AS Logs
FROM
Master
WHERE
(((Master.SubmitDate)<=#5/01/2010#) AND
(((Master.CompleteDate)>=#5/01/2010# Or (Master.CompleteDate) Is Null)));

it is basically showing me all open logs that are open on the first day of the month. In order to work this I have to change the date for each month and it can get tedious. I was hoping there was a way to do this using a crosstab or pivot table using a years worth of data(7/1 to 6/30). What do you think?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 15 Jul 2010 at 3:14am
Access is very SQL server like, though not an exact match, and with that said you could automate the query to a degree.  For SQL server, the date portion would be something like:
 
Convert(datetime, year(getdate()) +'-' + month(getdate()) +'-1')
 
Personnally I would want to set a variable for the getdate(), but I don't know if that is possible in Access
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Jul 2010 at 3:59am
The problem here is that you want to count records that were 'Not completed' during each month versus opened during a month, corrrect?
That means one row of data may need to be included in multiple counts. You can do that in one report using Running Totals, varaible formulas or sub reports but not a Crosstab.
Do you want to see one year of data from today or some other parameter?
IP IP Logged
ecathell
Newbie
Newbie


Joined: 14 Jul 2010
Online Status: Offline
Posts: 2
Quote ecathell Replybullet Posted: 15 Jul 2010 at 8:19am
thanks for the responses. This is a hindsight report. So its for the previous fiscal year.

so If I am running it today...it would be for the timeframe of 7/1/2009 to 6/30/2010. And that would be the dates I put in for my begin and ending dates.

if I cant do it in a crosstab thats fine...any kind of automation is better than having to do this by hand....even if its only once a year..
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Jul 2010 at 9:07am

your select statement for all records for 1 year would be something like:
(isnull({Master.CompleteDate}) or {Master.CompleteDate} in
dateserial(year(currentdate)-1,month(currentdate)-1,1) to dateserial(year(currentdate),month(currentdate),1-1)) and
{Master.SubmitDate}<=dateserial(year(currentdate),month(currentdate),1-1)

Then you can make 12 Running Totals
Name=MOnth1
Field to summarize=Master.masterID
Type of SUmmary=DistinctCount
Evaluate=Use a formula
(isnull({Master.CompleteDate}) or {Master.CompleteDate} in
dateserial(year(currentdate),month(currentdate)-2,1) to dateserial(year(currentdate),month(currentdate),1-1)) and
{Master.SubmitDate}<=dateserial(year(currentdate),month(currentdate),1-1)
Reset=Never
place in report footer
YOu can label the RT usning a formula
monthname(month(dateadd('m',-1,{currentdate})))
Do another running total called month2 the same way but change your evaluate formula to look at the 2 months ago...
(isnull({Master.CompleteDate}) or {Master.CompleteDate} in
dateserial(year(currentdate),month(currentdate)-3,1) to dateserial(year(currentdate),month(currentdate)-1,1-1)) and
{Master.SubmitDate}<=dateserial(year(currentdate),month(currentdate)-1,1-1)
label formula as
monthname(month(dateadd('m',-2,{currentdate})))
And so on for all 12
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.017 seconds.