FieldQuery() can do that, but a View using this function will be extremely slow on medium/large collections. You can use ZStats to periodically recalculate the values you need though.
Test with my Video collection, querying for DiCaprio movies:
save(ListSort(FieldQuery(Actors, Leonardo DiCaprio, Genre, 0, 1), 0),_stats)/
listmix([L1] /(ListCount(ListGrep([_stats],[L1]))/), 0, ListClean([_stats],1))
Outputs this, sorted by Genre:
Action (4);Adventure (4);Comedy (3);Crime (6);Documentary (1);Drama (18);History (4);Mystery (1);Romance (3);Sci-Fi (2);Thriller (6);Western (3)
Sorting by Count is trickier:
save(ListSort(FieldQuery(Actors, Leonardo DiCaprio, Genre, 0, 1), 0),_stats)/
save(listmix(ListCount(ListGrep([_stats],[L1]))=[L1], 0, ListClean([_stats],1)),_counts)/
listmix(regex([L1],/#(\d+)=(.+)#/,-1,0)[R2] /([R1]/),0,listsort([_counts],1))
Output:
Drama (18);Thriller (6);Crime (6);History (4);Adventure (4);Action (4);Western (3);Romance (3);Comedy (3);Sci-Fi (2);Mystery (1);Documentary (1)