omacron
Technical User
- Feb 5, 2002
- 149
Doing a top N report and need to show a percentage of total, but only of the feilds being displayed. Here is my data:
Item Qty_Sold
X1000 10
X2000 1
X3000 12
X4000 5
X5000 8
Top report: N = 3
What I want to display
Item Qty_Sold Percentage of Total
X3000 12 40%
X1000 10 33.3%
X5000 8 26.7%
Total: 30
Now I know how to do the Total Qty_Sold with this forumal:
whileprintingrecords;
numbervar qtysoldN;
if groupnumber <= {?N} then
qtysoldN := qtysoldN + Sum ({Qyt_Sold}) else
qtysoldN := qtysoldN;
If I use the built in function PercentOfSum it would use the total for all the items. Therefore instead of using 30 as the total it would use 36. This would screw up the Percentages. How can i do this?
Item Qty_Sold
X1000 10
X2000 1
X3000 12
X4000 5
X5000 8
Top report: N = 3
What I want to display
Item Qty_Sold Percentage of Total
X3000 12 40%
X1000 10 33.3%
X5000 8 26.7%
Total: 30
Now I know how to do the Total Qty_Sold with this forumal:
whileprintingrecords;
numbervar qtysoldN;
if groupnumber <= {?N} then
qtysoldN := qtysoldN + Sum ({Qyt_Sold}) else
qtysoldN := qtysoldN;
If I use the built in function PercentOfSum it would use the total for all the items. Therefore instead of using 30 as the total it would use 36. This would screw up the Percentages. How can i do this?