What you are mainly looking at here is dynamic grouping techniques.
See below
Many more examples here
https://forum.enterprisedna.co/search?expanded=true&q=%23enterprise-dna-online%20dynamic%20grouping
Work through these and you’ll see quickly what you need to do
Sam