Hello,
I am trying to get the Median based on certain criteria. I found these formulas on Business Objects website, and I am trying to modify them work for the report. I am using CR XI. Oracle DB.
Here are the formulas:
Note: the @BackLogResEval is a running total counting the records that fit the criteria. I know that I have 16 records that fit this criteria. Also I have a display formula names @BackLogResDisplay that display the number.
//Evaluate formula - placed in the detail section
WhilePrintingRecords;
EvaluateAfter ({@BackLogResEval});
NumberVar MedianRecNo;
NumberVar OddNoOfRecFlag;
NumberVar Median;
If (OnFirstRecord or {RPVW_PERMIT_SUMMARY.PERMIT_NUMBER} <> Previous({RPVW_PERMIT_SUMMARY.PERMIT_NUMBER}))
and {RPVW_PERMIT_SUMMARY.PERMIT_TYPE} in ['BLR1', 'BLR2' , 'BLR3' ,'BLRS' ,'BLR4', 'B-D1']
and {@CompletedPlans} = 'NO'
then
if {@BackLogResEval} = MedianRecNo then
(
if OddNoOfRecFlag = 0 then
Median := {@BackLogResEval}
else
Median := ({@BackLogResEval} +{@BackLogResEval}) / 2
)
Note: I tried to use a Next or Previous function but I get an error saying "NO Previous Or Next value.' So how can I step though each record?
This is in my initializing formula placed in the Report footer
//Initializing formula
WhilePrintingRecords;
EvaluateAfter ({@BackLogResDisplay});
NumberVar MedianRecNo;
NumberVar OddNoOfRecFlag := 1;
MedianRecNo := Round (({@BackLogResDisplay}) / 2);
if Remainder(({@BackLogResDisplay}), 2) > 0 then
OddNoOfRecFlag := 0
Thanks,
Greg
I am trying to get the Median based on certain criteria. I found these formulas on Business Objects website, and I am trying to modify them work for the report. I am using CR XI. Oracle DB.
Here are the formulas:
Note: the @BackLogResEval is a running total counting the records that fit the criteria. I know that I have 16 records that fit this criteria. Also I have a display formula names @BackLogResDisplay that display the number.
//Evaluate formula - placed in the detail section
WhilePrintingRecords;
EvaluateAfter ({@BackLogResEval});
NumberVar MedianRecNo;
NumberVar OddNoOfRecFlag;
NumberVar Median;
If (OnFirstRecord or {RPVW_PERMIT_SUMMARY.PERMIT_NUMBER} <> Previous({RPVW_PERMIT_SUMMARY.PERMIT_NUMBER}))
and {RPVW_PERMIT_SUMMARY.PERMIT_TYPE} in ['BLR1', 'BLR2' , 'BLR3' ,'BLRS' ,'BLR4', 'B-D1']
and {@CompletedPlans} = 'NO'
then
if {@BackLogResEval} = MedianRecNo then
(
if OddNoOfRecFlag = 0 then
Median := {@BackLogResEval}
else
Median := ({@BackLogResEval} +{@BackLogResEval}) / 2
)
Note: I tried to use a Next or Previous function but I get an error saying "NO Previous Or Next value.' So how can I step though each record?
This is in my initializing formula placed in the Report footer
//Initializing formula
WhilePrintingRecords;
EvaluateAfter ({@BackLogResDisplay});
NumberVar MedianRecNo;
NumberVar OddNoOfRecFlag := 1;
MedianRecNo := Round (({@BackLogResDisplay}) / 2);
if Remainder(({@BackLogResDisplay}), 2) > 0 then
OddNoOfRecFlag := 0
Thanks,
Greg