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

Calculating Weighted Average in Crystal Reports XI 1

Status
Not open for further replies.

Madawc

Programmer
Sep 5, 2002
7,628
0
0
GB
Running totals include Weighted Average as one option. If you're not already familiar with Crystal's automated totals, see FAQ767-6524.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
First change {@days_worked} to:

if {S_CLKB_DECISIONS_BY_DAY;1.dec_cnt} > 0 then
{S_CLKB_DECISIONS_BY_DAY;1.dec_day} else
{@null}

...where {@null} is a new formula that you create by opening and saving a new formula without entering anything.

Remove the summary on {@avg_wrkd} from the crosstab. Then add a distinctcount of {@days_worked} as your second summary.

Next, in preview mode, select the first summary (sum of dec_cnt) for all row totals simultaneously and right click->format field->suppress->x+2 and enter:

whileprintingrecords;
numbervar sumx := currentfieldvalue;
false

Then select the second summary (dcnt of {@days_worked}->right click->format field->suppress->x+2 and enter:

whileprintingrecords;
numbervar cnt := currentfieldvalue;
false

In the same screen, go to display string->x+2 and enter:

whileprintingrecords;
numbervar sumx;
numbervar cnt;
if cnt = 0 then "0" else
totext(sumx/cnt,2)

Then suppress the inner cells for the days_worked summary.

-LB
 
Thanks Ibass,

It works. Can I ask you one more question please?
Current report has only the team total. How can get the Center total end of the report?

Really appreciate it!

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top