Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: This Year vs Last Year Post Reply Post New Topic
Author Message
delstar
Newbie
Newbie


Joined: 11 Jun 2009
Online Status: Offline
Posts: 26
Quote delstar Replybullet Topic: This Year vs Last Year
    Posted: 09 Apr 2010 at 11:05am
OK, this is starting to bug me. It sounds like it should be simpler than it is. Basically, I have a number of records with a date field. I have been given a request for a report to have the following layout ('period' should be considered as the last 7 days) :

Item Desc. | Current Period | Current YTD | Last Year Period | Last Year YTD
----------------------------------------------------------------------------------------

Where each row gives the description and counts for each column according to the label.

I can't even get the Current Period to show properly. I tried creating a field with the formula :
{@date}=last7days
That gives me a count, but seperates it into two columns, true and false. I don't even know where to begin with the 'Last Year Period'. Can anyone help?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Apr 2010 at 12:02pm
You can use Running Totals (RT) to do Counts conditionally.
RTs only work in Footers
Group on item desc.
Suppress group header and details
Place the item desc in the group footer
create a RT as "Current period Count"
Field to sumamrize=date field
type=count
evaluate = use a formula
table.datefield in last7days
reset=on group change (group1)
 
Same thing for current year but change your formula to
table.datefield in YearToDate
 
LastYearPeriod
table.datefield in dateserial(year(currentdate)-1,month(currentdate),day(currentdate)-7) to dateserial(year(currentdate)-1,month(currentdate),day(currentdate))
 
Last year ytd as
table.datefield in LastYearYTD


Edited by DBlank - 10 Apr 2010 at 6:11am
IP IP Logged
delstar
Newbie
Newbie


Joined: 11 Jun 2009
Online Status: Offline
Posts: 26
Quote delstar Replybullet Posted: 12 Apr 2010 at 5:17am
Thank you. This is exactly what I needed.
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.016 seconds.