Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Separating a field data Post Reply Post New Topic
<< Prev Page  of 2
Author Message
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 05 Mar 2012 at 2:48am
So I eventually got what you were saying above to work...but it is still coming out with the same info...looks like this:
0
0
3000
0

any other suggestions or should I just give up?? haha
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 05 Mar 2012 at 3:21am
Hi, I haven't read the entire thread just your first post so apologies if I'm treading on toes, but this is how I'd do it.
 
First create a blank formula, for example's sake we'll call it @group.
 
Now create another formula as follows, we'll call it @month.
 
@Month
left(monthname(month({table.datefield})),3) & "-" & year({table.datefield})
 
Now create 2 groups, the first being on @group and the second on @month.
 
Now create a formula as follows to find the most recent forecast within each month, we'll call it @Jan12.
 
if {table.datefield} = maximum({table.datefield},{@month})
and {@month} = "Jan-2012"
then {table.amountfield}
else 0
 
Create a version of the above for each month, then summarize as follows.
 
@Jan12sum
 
(Instead of creating summaries you could sort the records descending by {table.datefield} and just use the Jan12 formula in the group 1 header/footer - I prefer using formulas though).
 
That should work, you could do this all automatically using the pivot function in a SQL command, however.
 
Regards,
Ryan.
 
EDIT: Minor amendments.
 


Edited by rkrowland - 05 Mar 2012 at 3:55am
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 05 Mar 2012 at 4:12am
Thanks for the reply...I have tried it this way as well and when I get to the last formula I get an error that says:  "This field cannot be summarized" and it highlights {@amount}.

Also, I don't want to sum the the qty's for a month, I want to display the most recent entry...so if there were 2 records for Jan on lets say the 12th and 23rd...I would only want to see the qty for the 23rd
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 05 Mar 2012 at 4:15am
Hi, check my amended formulas above - I thought that might happen so changed it. I hoped I'd done it before you read the original post.
 
Also,
if {table.datefield} = maximum({table.datefield},{@month})
makes it only count the most recent entry in each month.
 
Regards,
Ryan.
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 05 Mar 2012 at 4:59am
I am still getting a "This field cannot be summarized" error when I do the sum formula...
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 05 Mar 2012 at 10:12pm
Originally posted by rkrowland

Instead of creating summaries you could sort the records descending by {table.datefield} and just use the Jan12 formula in the group 1 header/footer - I prefer using formulas though
 
Try that instead of creating summaries.
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 06 Mar 2012 at 2:43am
That doesn't work because the formula I have for Feb12 (same as jan12 just modified for Feb) isn't pulling the Feb data out...it is still pulling all data so when I look at the report it shows all Jan numbers as 0, then the Feb numbers (which is right) then the Mar numbers which are 0...so when I move the field into the group header section I get a 0 (because the is the first record...
What it seems is that I need to write a formula that only pulls the data by month, not jsut make all the other months a 0...which is why I am confused haha
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 06 Mar 2012 at 4:21am
Which is why you need to perform a record sort descending by your datefield, so the most recent record is always at the top of each month group.
 
Your February group should only contain records from February if you did everything right.
 
Regards,
Ryan.


Edited by rkrowland - 06 Mar 2012 at 4:22am
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 06 Mar 2012 at 4:36am
Ok, well then I am guessing I didn't do it right...I will go over it all again and see...

Thanks for the help
IP IP Logged
arigatou
Newbie
Newbie


Joined: 13 Mar 2012
Online Status: Offline
Posts: 3
Quote arigatou Replybullet Posted: 18 Mar 2012 at 3:43pm
This is why you need to perform the sort of your DateField drop to record the most recent record is always the top of the month.
IP IP Logged
<< Prev Page  of 2
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.016 seconds.