If you are using FileMaker 11, you can set up each total in a one row filtered portal where the portal filter expression specifies the category. A summary field defined in the portal table will then correctly compute and display the total.
You may need to add a triggered script such as:
Refresh Window [Flush cached Join results]
To get the totals to update whenever a field on the layout affecting such totals is edited.
Ok, thanks. And if i did this outside of the portal w/ a basic field, how would i write that calculation?
I know this isn't how to write it, but basically i want to say "total all withdrawals under category X in the month of january".
That option requires considerable more design work. You'd need category specific relationships for each such calculation field to use so that Sum ( RelatedField ; cBal) will return the correct value. You can also use the summary field from the portal's table, but select it from the occurrence set up for each category based relationship.
This added complexity, which is also very inflexible, is why I've suggested the filtered portal approach.
A typical category specific relationship would look like this:
MainTable::PrimaryKey = PortalTableEnt::ForeignKey AND
MainTable::constEntertainment = PortalTableEnt::Category
constEntertainment is a calculation field with "Entertainment" as it's expression so that all records in MainTable have the same value in it.
You'd need such a const field and added occurrence of the portal's table for each category.