Hi Wilbye,
If I understood it correctly, I think you don't need a new structure, you just need to group by the appropriate attributes in the aggregate and at the right order too. Or include in the join the source entity of the Name and RRFNo..You must group it in the aggregate as the same sequence in the above select statement (category_id, category, employee name, rrfno, position, skill_set, level and business_tower).
Then you need to add another attribute in the aggregate (for the count of category_id). You will notice then that the aggregate will return a structure like result based on your group by.
Lastly, another way is to create a function (server action) were in it will return a the count you wanted by putting inside an expression (your third column). But I think it will be heavy at the UI side.
Hope this helps,
Thank you and kind regards,
Chris