Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I Make This One Field (Instead of Two)

Status
Not open for further replies.

cLFlaVA

Programmer
Jun 14, 2004
6,450
US
Hi.

I've created a manual cross-tab so that I'll be able to get the percentage of the column for each group.

To do this (for each column) I created one formula, like so:
[tt]
// name: @lla107db
If UpperCase({GCRSp_BuPctOfSvrRcs;1.RateCode}) = 'LLA107DB' Then
{GCRSp_BuPctOfSvrRcs;1.Total}
[/tt]

Then, I created a second formula to show the percentage of the group. I did this because when groups had 0's for each row in the column, the percentage would show up as blank. I need it to show up as 0.

[tt]
// name: @pct_lla107db
({@lla107db} / Sum({@lla107db})) * 100
[/tt]

Is there any way to combine these two into one, to make maintenance easier? I tried combining the formulas but got incorrect data...did something wrong...

Thanks.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Try:

// name: @lla107db
If UpperCase({GCRSp_BuPctOfSvrRcs;1.RateCode}) = 'LLA107DB' Then
({GCRSp_BuPctOfSvrRcs;1.Total}/Sum({GCRSp_BuPctOfSvrRcs;1.Total})) * 100
else
0

If this doesn't help, perhaps you can post where these formulas are, what you tried and what the result was?

The version of your software nmight help also.

-k
 
Ordinarily, a manual crosstab has formulas like {@lla107db} at the detail level. You then right click on each formula and insert a summary at the group level, and then suppress the details. Assuming you have a group and that what you want is the percentage at the group level, I think your formula should look something like the following, where {table.groupfield} is your group field:

sum({@lla107db},{table.groupfield}) % Sum({@lla107db})

You could also use the "/" + "*100" approach, but it's easier to just use "%" and click on the percentage icon in the toolbar to get the correct format displayed.

-LB
 
Forgot to add that I think you do need two separate formulas to do this.

-LB
 
synapsevampire-

Thanks for the suggestion, unfortunately I get same incorrect data that I got when I tried to combine the two formulas.

I'm using Crystal 8.5.

Originally, I created the field @lla107db. I then followed both the FAQ in one of these Crystal Reports forums as well as the very helpful article at support.businessobjects.com. I created a static column title, LLA107DB. I created two groups. I then inserted a summary of the @lla107db formula, and checked the "insert summary for all groups" checkbox. I then selected "show as percentage of group #1".

Again, this works fine with 2 formulas (one for numerical value, and then one for percentage), I just wanted to try to get this into one formula, as I'll be making 12 reports like this, each with between 7 and 10 columns.

Thanks a lot - let me know if you need more info.


lbass- your solution works as well, but I'd like to get this into one formula if possible.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top