Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula Not Working Post Reply Post New Topic
Author Message
bholt
Newbie
Newbie


Joined: 30 Oct 2012
Online Status: Offline
Posts: 16
Quote bholt Replybullet Topic: Formula Not Working
     Posted: 14 Nov 2012 at 9:22am
Hi all.

So I have 2 formulas written trying to find the total for 2 different constituent groups in CR. The first formula works fine, but the 2nd gives me the same # and it shouldn't. Any ideas why this might be happening and/or how to fix it?
 
Here are the two formulas I"m using.
 
if {GfCnBio.GfCnBio_Constit_Code} = "Indiv" then SUM ({@MTD_Only})
 
That one works correctly.
 
Then I used this one to get the sum for that month (MTD_Only) for those coded as Major Donors. I tried the following 3 formulas. Each one gives me the same # as the above formula, which is definitely not right:
 
if {GfCnBio.GfCnBio_Constit_Code}  <>  "Indiv" then SUM ({@MTD_Only}) else 0
 
if {GfCnBio.GfCnBio_Constit_Code}  =  "Major Donor" then SUM ({@MTD_Only}) else 0
 
if {GfCnBio.GfCnBio_Constit_Code} = "Major Donor" then SUM ({@MTD_Only})
 
What am I missing here?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Nov 2012 at 9:51am

not sure what you are trying to do exactly.

YOu cannot use a where clasue to alter the amount in a sum so each of your fomruals is retutning exactly what you put in the formula which is the sum of MTD_only.
If you want to sum a vlaue when a the row has a specific value like 'Indiv" there are 3 different ways to do this.
1-formulas to zero out each row (I am guessing this is what your MTD_only formula is doing)
2- Variable formulas
3. Running Totals
IP IP Logged
bholt
Newbie
Newbie


Joined: 30 Oct 2012
Online Status: Offline
Posts: 16
Quote bholt Replybullet Posted: 14 Nov 2012 at 10:50am
Hmm ok. I think I understand what you're saying.
 
I have a formula set up so that I can see the month to date total from a list of YTD gifts (well last month's). That formula is:
 
if {Gf.Gf_Date} in LastFullMonth then {GfFnds_1.GfFnds_1_Amount} else 0
 
and then I have the SUM of that formula and that gives me the amount of giving for that particular month for all constituents.
I need to separate out the 2 constituent codes, though, so I can see the month to date giving for each one separately.
 
Basedon what you just said I tried this, but then I get $0.00 which also isn't right...
 
if {Gf.Gf_Date} in LastFullMonth and {GfCnBio.GfCnBio_Constit_Code} = "Indiv" then {GfFnds_1.GfFnds_1_Amount} else 0
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Nov 2012 at 10:57am

what you are doing seems correct.

It is a line by line way to zero out rows you want to exclude for that sum.
if you place it on the detail section you will see it zero out all values that are not in the last month and not for a row identified as 'Indiv'.
Now you can sum this formula field for the whole report to show you all of the indiv amounts togther
SUM(formula)
Or if you have groups (constituents) you can sum at the group level (you have to palce the fomrual in the group footer) to show you only Indiv gists in the last nmont per consistuent
sum(formula,groupfield)


Edited by DBlank - 14 Nov 2012 at 10:58am
IP IP Logged
bholt
Newbie
Newbie


Joined: 30 Oct 2012
Online Status: Offline
Posts: 16
Quote bholt Replybullet Posted: 14 Nov 2012 at 11:07am
Ah HA! It was the placing it in the details section I was missing. Got it! Thank you!
 
So I've got the 2 formulas now summing each const. code. totals for the month.
 
Is there a way to place them both in the same spot, and suppress one on the first page and the other on the 2nd page? That's the last thing I need to figure out, but if not it's no big deal, I'll just create 2 lines.
 
Thank you!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Nov 2012 at 11:19am
you can conditionally suppress a field based on the pagenumber.
rightclick on each field
format field
common tab
suppress formula
pagenumber=1
this will suppress the field on the first page
pagenumber=2
use this to suppress a field on the second page
 
FYI-you do not have to place the other formulas on the detail section to make them work. I just recommended to do it so you can see what it is doing to understand the process.


Edited by DBlank - 14 Nov 2012 at 11:20am
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