Introduce count_by with a secondary field

I've re-used "count_by" the expression because there isn't ambiguity, but happy to give it a different name too if people prefer.
Just supporting the bare minimum here - unless we know we need a slightly different variation on this before switch to i-lang.