I assume that the totals shown in bold face are placed in Sub Summary layout parts?
If so, take a look at the getSummary function. If you refer to a summary field in a calculation, you get the same total that you'd see in a grand summary layout part not the sub total from the sub summary part. But if you use GetSummary and specify the same "break" field specified for the sub summary layout part, you can access that sub total and use it in your calculation.
I looked at the getSummary function and created type calculation field with the following Calculation on the BankTransactions table
(GetSummary ( Sum Expenses ; ReportCategory::_pk_MajorCategory ) / Sum Expenses) (Calculation result is Number)
My original input description above is not correct. I've added a table for the Major Categories called ReportCategory so the relationship looks like this.
The Report is based on the BankTransactions table with a Summary Part for the BankTransactions::_fk_Category break field and uses the BankTransactions::Sum Expenses field.
A second Summary Part is based on the break field ReportCategory::_pk_MajorCategory and uses the same Sum Expenses field.
A Trailing Grand Summary Part also uses the Sum Expenses field.
All summary totals are correct but the calculation field I added shows 0. What am I missing?
You've hit your toe on a significant detail where what you have works for the sub summary part ,but not the GetSummary function. For a sub summary part, your break field can refer to a field in a related table. but this does not work in the GetSummary calculation where both summary field and break field must come from the same table occurrence.
But you can usually get around this limitation by adding a calculation field in your summary field's table (BankTransaction) that copies the field from the related table. You then need to include this field in your sort order. So a calculation field that simply has:
as its sole calculation term should work in your getsummary function if you include this new calculation field in your current sort order.
ok...I'm still getting a result of 0.
I added the Calculation field and verified the result on a layout. I also added the calculation field to the report layout and to the script in the current sort order. Do I need to redo the report or have I missed something else?
Ignore my last post...I made a dumb mistake. Your solution works perfectly Phil...Thank you again. You're the best.