Notes calculates totals for categorized views, but does not sort them.
So if you need it anyway, you have to
- navigate the categories in the non-sorted but categorized view (by means of the NotesViewEntry… classes)
- create a new document for each category with a field to record that total and a field to record that category
- add a non-categorized view for showing the new documents with a sorted column for the total field
Here is the LS code for an agent that implements 1- and 2-
{[.=Totals of categories= /enzymes/chili-ls.php]}
(revised text from my own comment 12349447 at Experts-Exchange)