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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perform calculation only using details in current group

Status
Not open for further replies.

shuber1

IS-IT--Management
Jan 29, 2010
8
US
Hi,

I'm trying to perform a calculation using detail values for the current group. However, it's using detail values from other groups.

The report is grouped by Test # and I want to perform calcuations using the detail values for the current Test #.


Group #1 - Test 123
Details
(Element) (Value)
NI .3
FE .57

I have a formula next to Test 123, but the formula is wrong because it's pulling values from other grops. Please see the formula below:

If {Tbl.Element} = "NI" then numbervar NI := {Tbl.Value};
If {Tbl.Element} = "FE" then numbervar FE := {Tbl.Value};
NI-FE;

Can someone please tell me how to only use the values for the current Test #?
 
If there is only one instance of each value per test group, I would just create formulas like this:

//{@NI}:
if {Tbl.Element} = "NI" then {Tbl.Value}

//{@FE}:
if {Tbl.Element} = "FE" then {Tbl.Value}

Then use a formula like this in the group header or footer:

sum({@NI},{table.test#})-sum({@FE},{table.test#})

-LB
 
Hi LB,

I agree with you. I should insert a sum subtotal for NI and FE and then have a formula like,

sum({@NI},{table.test#})-sum({@FE},{table.test#})

However, I need to calculate Standard Deviation on the formula results. When I try to calculate Standard Deviation on the formula, I receive the following error message, "This field cannot be summarized".

How can I calculate Standard Deviation on,
sum({@NI},{table.test#})-sum({@FE},{table.test#})?
 
You'd have to remind me what the formula is for SD.

You should have laid out your goal in the first post, by the way.

-LB
 
I apologize for not being clear about my goal.

I asked how to write a formula that only uses detail values for the current group because I need to calculate Standard Deviation on that formula. It appears that Standard Deviation cannot be calculated when you use group header values.

Because Standard Deviation formula is so complex, you can call it in Crystal in 2 ways:

1) a formula, StdDev({tbl.field})

2) right click the detail field, Insert--> Running Total --> Type of Summary --> Sample Standard Deviation.

Therefore, how can I calculate Standard Deviation on,
sum({@NI},{table.test#})-sum({@FE},{table.test#})?
 
Well, you can't use those methods with a summary, which was why I was asking for the basic stddev formula. I think you'd have to create the calculation from scratch.

-LB
 
Np LB. This takes me back to my original question.

How can I perform a calculation only using detail values for the current group? When I attempt to do this, the calculation is using detail values from other groups.

As a reminder, my report is grouped by Test # and I want to perform calcuations only using the detail values for the current Test #.

Group #1 - Test 123
Details
(Element) (Value)
NI .3
FE .57

Here is how I currently have my formula:

If {Tbl.Element} = "NI" then numbervar NI := {Tbl.Value};
If {Tbl.Element} = "FE" then numbervar FE := {Tbl.Value};
NI-FE;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top