Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Displaying all months between two dates Post Reply Post New Topic
Author Message
lissa1974
Newbie
Newbie


Joined: 11 Aug 2008
Online Status: Offline
Posts: 2
Quote lissa1974 Replybullet Topic: Displaying all months between two dates
     Posted: 11 Aug 2008 at 8:45am

Hi there, I'm using Crystal 2008 with SQL. I'm basically stuck, in that I can't think how I can go about creating a report that will show me what I need. I've been using Crystal for a number of years but this has stumped me.

 

I have line items like below....

 

Item     Start Date      End Date     Value

 

1        01/01/2007      31/12/2008   £100

2        01/01/2007      31/12/2008   £500

3        01/01/2007      31/06/2008   £100

 

All the above data is on one table, and basically shows items on one contract. The items on contract can be for different time periods, so some can end before others. I'm trying to get a monthly total that basically shows for each month, but doesn't count an items value if it's dropped off. I can simply take each line item, and divide the total by the number of months, so line 1 is £100/12, 2 is £500/12 and line 3 is £100/3

 

 

The report we'd like to see at the end of it is something like this.....

 

Item    Jan 08   Feb 08  March 08 April 08 May 08 June 08

 

1       8.33     8.33    8.33     8.33     8.33   8.33 

2       41.6     41.6    41.6     41.6     41.6   41.6

3       33.3     33.3    33.3     0          0        0 

 

Total 3.23    83.23   83.23  49.93   49.93  49.93

 

 

I'm just not sure how to go about this. Ultimately what I want is for the total at the bottom to basically show the grand total for many contracts (with many line items having different ending dates within them).

 

So as the months could stretch over a few months or a few years, I'm guessing a cross tab is the way to go. I just have no idea how I can start this to make it separate the values into each column.

 

Any help is very much appreciated,

 

Regards

Adam

IP IP Logged
RitaInHood
Newbie
Newbie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 25
Quote RitaInHood Replybullet Posted: 11 Aug 2008 at 2:17pm
How about, for each line first calculate $/mo
value / datediff('M',start, end)
Next for each month column, give yourself an if/then to see if the $/mo should be displayed here

if start <1/1/08
   then if end > 1/31/08
           then $/mo
           else 0
   else 0

Where this doesn't work is if you need to show multiple years worth of data, in which case how do you want it to display?
IP IP Logged
lissa1974
Newbie
Newbie


Joined: 11 Aug 2008
Online Status: Offline
Posts: 2
Quote lissa1974 Replybullet Posted: 12 Aug 2008 at 2:11am
Hi there, thanks for the reply. The problem I have is that the items could span over a year. So line item 1 above could be from 01/01/2007 to 31/12/2008, whereas line item 3 might be just for 01/01/2007 and end on 01/07/2007, meaning my totals for Jan-July 2007 would be higher, but when item 3 ends the total should decrease in July 2007 total to show.
 
So ultimatly, doing it in a cross tab I could have 36 months running across the top, but after the first 6 months line item 3 would be 0's for the remaining 24 months. I then need this totalling.
 
Any ideas?

Thanks
 
IP IP Logged
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