I can't figure it out to translate that code into a Grouping. I wonder if that would be helpful for you though, if you have several combinations of project teams they will all show as different groupings and would be hard to track that X person is in 15 projects but show in different groupings bc of any change in the project team. Sorry I couldn't be more help!
If this helped you, please mark correct to help others : )