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!

Subtotaling (Sum) on Formula fields

Status
Not open for further replies.

Jasonic

Technical User
Jun 20, 2001
69
GB
Dear Community

I have a main report that is linked to a datasource like so..

Employees Employees_1 Employees_2
lParentId lEmployeeID
lParentId lEmployeeID

Which gives a three tiered structure, denoting Business Unit (Employees_2), Department (Employees_1), User (Employees)

I have three sub reports with in the main report, linked on the Employee_1.lEmployeeID

So for each Department, the sub report returns the number of Entitlements, number of users and finally usage. (These are returned to the main report in Shared variables).

So the main report has three shared variables
@Entitlement
@Users
@Usage

For each Business Unit I need the sum of the @Entitlement, @Users and @Usage.

Any Idea how I would acomplish this?

Thanks
Jason

Jason Thomas
AssetCenter Consultant
Jason Thomas Consultancy Limited
[rolf]
 
Post what section the subreports are within the main report, and where you want to display results, the other info is nice to have, but we need to know the basics first.

Typically a 3 formula method is used for this, I'll assume that you have a grouping by the business unit, and somewhere within inner groupings or the details you've placed the subreports.

Business unit group header formula:
whileprintingrecords;
numbervar SumEntitlement:=0;
numbervar SumUsers:=0;
numbervar SumUsage:=0;

Now wherever you are using the shared variables back in the main report, add in the appropriate shared variables above similar to this:

whileprintingrecords;
numbervar Entitlement;
numbervar Users;
numbervar Usage;
numbervar SumEntitlement:=SumEntitlement+Entitlement;
numbervar SumUsers:=SumUsers+Users;
numbervar SumUsage:=SumUsage+Usage;

Then in the BU Group Footer you can reference the variables:
whileprintingrecords;
numbervar SumEntitlement;
"Totals Entitlement: " & SumEntitlement

whileprintingrecords;
numbervar SumEntitlement;
"Totals Users: " & SumUsers

etc.

If the above doesn't work, and in all future posts, please be specific about WHERE everything is.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top