Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Running Total for Current Year Only Post Reply Post New Topic
Author Message
jhudson77
Newbie
Newbie
Avatar

Joined: 27 Feb 2008
Location: United States
Online Status: Offline
Posts: 8
Quote jhudson77 Replybullet Topic: Running Total for Current Year Only
     Posted: 31 Mar 2008 at 10:05am
Hi everyone...............I did a search for this topic already but didn't come up with anything.  I would have figured this would have been addressed already but I guess not - either that or it's so simple that no one would need to ask the question.  LOL
 
Anyways.....I am trying to do a running total that totals numbers based on the current year only.  I figure that it will have to be a manual total but not too sure what the formula would look like.  Anyway to do this by checking the system date and doing this automatically?
IP IP Logged
jgh1204
Newbie
Newbie


Joined: 13 Mar 2008
Location: United States
Online Status: Offline
Posts: 20
Quote jgh1204 Replybullet Posted: 31 Mar 2008 at 10:18am
The running total dialogue box has a formula evaluation option.
 
You could try:
 
year(trx_date_field)=2008
 
Not very elegant, but should work. 


Edited by jgh1204 - 31 Mar 2008 at 10:34am
IP IP Logged
jhudson77
Newbie
Newbie
Avatar

Joined: 27 Feb 2008
Location: United States
Online Status: Offline
Posts: 8
Quote jhudson77 Replybullet Posted: 31 Mar 2008 at 11:48am

I think maybe I explained my current report wrong.

Let's say I have three fields in the report: start date (Start_Date), end date (End_Date), and total sales (Total_Sales).
 
In the report footer, I am summarizing via two separate running totals two different totals.  One is all of the Total_Sales over time and the other is the Total_Sales for just this year (based on the End_Date being 2008).
 
The first running total is a piece of cake - pretty straightforward.  But, how do I compare the system date to the End_Date to do a running total of just the numbers for this year?
IP IP Logged
jgh1204
Newbie
Newbie


Joined: 13 Mar 2008
Location: United States
Online Status: Offline
Posts: 20
Quote jgh1204 Replybullet Posted: 31 Mar 2008 at 1:18pm

Create another running transaction field using the same amount that you want totaled.  In the evaluate by function box, put this formula.

 
year(currentdate)=year(trxdate)


Edited by jgh1204 - 31 Mar 2008 at 1:20pm
IP IP Logged
jhudson77
Newbie
Newbie
Avatar

Joined: 27 Feb 2008
Location: United States
Online Status: Offline
Posts: 8
Quote jhudson77 Replybullet Posted: 31 Mar 2008 at 1:22pm
What is "trxdate"?
 
BTW, I'm using CR9.
IP IP Logged
jgh1204
Newbie
Newbie


Joined: 13 Mar 2008
Location: United States
Online Status: Offline
Posts: 20
Quote jgh1204 Replybullet Posted: 31 Mar 2008 at 1:36pm
trxdate is whatever your field name is for your ending date.
 
Year(x) is a function that returns the year value from a date.  Currentdate is a function that returns the current system date.  So year(currentdate) returns the year of the system date.  Year(Ending_date) returns the year of the transaction date.
 
So the evaluation function is true when year(currentdate)=year(ending_date).
 
My first example of year(ending_date)=2008 would work(at least until 12/31/08). 


Edited by jgh1204 - 31 Mar 2008 at 2:05pm
IP IP Logged
jhudson77
Newbie
Newbie
Avatar

Joined: 27 Feb 2008
Location: United States
Online Status: Offline
Posts: 8
Quote jhudson77 Replybullet Posted: 01 Apr 2008 at 5:35am
That worked beautifully!  Thank you for your help!
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