Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Sum with Date from Formula Post Reply Post New Topic
Author Message
eGeeked
Newbie
Newbie


Joined: 10 Sep 2012
Online Status: Offline
Posts: 1
Quote eGeeked Replybullet Topic: Sum with Date from Formula
    Posted: 10 Sep 2012 at 7:00am

I am relatively new to Crystal but I am learning quick. I am trying to have a SUM of a field appear using a specific date array built into a formula. Below I will show my code and explain things a little better.

These first 2 formulas get me the first day of the month and the last day. I have several of these for going back several months.

@11BackBeg


Local DateTimeVar d := {TimeRecord.ActualDateTime};
DateSerial(Year(d), Month(d) - 0 - 11, 1)

@11BackEnd


Local DateTimeVar d := {TimeRecord.ActualDateTime};
DateSerial(Year(d), Month(d) - 0 - 10, 0)

Now I have a formula to get me the range I want to pull from - I need a way to tell it where I want to pull from and for who, so I have.

@11Back Time


{TimeRecord.OwnedBy} = {?AS Team Member} and
{@ActualDate} in {@11BackBeg} to {@11BackEnd}

So I need to make the SUM of the field display for in between these dates, I am unsure how to write the SUM function. I currently have whats below but need a little help making it work.


Sum ({@F AdminTime}, {TimeRecord.OwnedBy})

I appreciate all your help, thank you.

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 14 Sep 2012 at 8:56am
So, if I understand you correctly, you're trying to sum only the numbers that are between the specific start and end dates.  Is that correct?
 
If so, you have a couple of options.
 
1.  Create a formula and then sum it.  The formula would look something like this:
 
If {TimeRecord.OwnedBy} = {?AS Team Member} and {@ActualDate} in {@11BackBeg} to {@11BackEnd} then
 {@F AdminTime} else 0
 
2.  Use a running total that evaluates on the formula 
{TimeRecord.OwnedBy} = {?AS Team Member} and {@ActualDate} in {@11BackBeg} to {@11BackEnd}
 and resets as needed.
 
If you only need the summary at one group level I would use the running total, if you need it at more than one, I would use the formula/sum.  This is because you would have to create a separate running total for each level where the summaries would require just the one formula and can be set up for all group levels at the same time.
 
-Dell
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.035 seconds.