Ratio of Group Level Data against Summary Data - Crystal Reports -


i having trouble finding way ratio summary data against group level data (not detail level)

a simplified version on problem follows:


say, have 2 tables 1 many relationship

stock left outer join sales on stock.barcode=sales.barcode 

the report layout follows:

grouphead2 | grouphead1 | sales$                       %             stock$      % details    | sales groupfoot1 | a=sum(sales,{group1})       a/b            c=stock      c/d groupfoot2 | b=sum(sales)                               d=sum(stock) 

i can ratio a/b work follows:

a/b = sum({sales},{group1})/sum({sales}) 

but "d" running total (made running total wizard) because want stock on hand each barcode vs sum of sales each barcode

thus if try ratio "c/d" receive error.


edit: output looks follows - say:

sales$   %            stock$   %      200      13.3         50       100 300      20           20       28.5  800      53.3         30       30 200      13.3         10       9.1 ---------------------------------------------------------------- 1500                  110 

note percentage stock wacky because recalculating total (running) on each line instead of using total value (eg 110)


edit 2:

i saw similar question , hoping offer adaption (which has escaped me) of answer suit above scenario.

the answer follows:
sum ({ numeric field }, { grouping item }) % sum ({ numeric field })

the problem different mine { numeric field } introduced @ group 1 level needs evaluated once per group 1


i'm guessing there maybe way "d" without using running total (?) or better way make ratio "c/d"?

any appreciated

thanks b


Comments