"sorted" isn't quite the right term, but yes. If you are using FileMaker 11 or 12, you can set up filtered portals where the filter expression limits the portal records to just those that meet the filter criteria.
The portal filter for your first portal might look like this:
PortalTable::Category = "Food" // or maybe "food expense" -- whatever value identifies food expense records
In earlier versions, this is still possible, but the "filtering" has to take place at the relationship level with different combinations of match fields.
But these are not the only options.
ExecuteSQL calculations could produce tab and return delimitted data such that you get the same basic result, but in a single field instead of a portal.
A summary report can be set up on the portal's table with SubSummary layout parts such that each expense category is listed as a sub heading with the expense records from that category listed below it and with a sub total computed for that category.
This last option can be a better approach if you need this for a report--especially a printed report.
I think the easiest and best way would be the portal filter . When I went to try it, I couldn't get it to work but I think it is because my category's are defined by a value list. Do I need to identify the value list and then desired value?
For ex: PortalTable::Category :: valuelist_category ="Food expense" ?
Nope. You need to correctly reference the field that you have formatted with the value list and it needs to match values exactly. The presence of a single space or a return character can keep the above expression from working because then the text in the field doesn't exactly match the text in quotes.
Are your categories selected from a set of checkboxes or a different format of value list? (checkboxes can complicate this process as the field then can store multiple values separated by returns.
And make sure that your field is defined as a field of type text and not number...
I have it matching exaclty, my field is a text, ... I think I must be missing something. Should the category be an id? It's not coming up as an error; it's just showing me all of the items - no filtering. (And just in case I made sure that field was included in the displayed portal fields.
It does not need to be an ID. It won't bring up an error message if it doesn't work. The field does not need to be visible in the portal--but it can help for debugging errors.
Please copy and paste the exact filter expression you are using inside Portal Setup for this portal. Please identify the exact text shown in the "Show Related Records From" drop down in portal setup for this portal.