Hello @Drish, I think we can definitely make this work! First, I’d say lets get the number of distinct employee genders per team to exclude any teams that contain both.
gendersPerTeam = distinctCountOver({Gender}, [{Team}, PRE_AGG)
Now only return Teams that have a value of 1:
teamsWithOneGender = ifelse({gendersPerTeam} = 1, {Team}, NULL)
Now we can check for the distinct count of teams with 1 or the other:
teamsWithMen = ifelse({Gender} = "Man", {teamsWithOneGender}, NULL)
teamsWithWomen = ifelse({Gender} = "Woman", {teamsWithOneGender}, NULL)
Now you can run distinct count on each function! It may require a distinctCountOver because of the previous syntax, so I’ll type it out:
countOfTeamsWithMen = distinctCountOver({teamsWithMen}, [], PRE_AGG)
countOfTeamsWithWomen = distinctCountOver({teamsWithWomen}, [], PRE_AGG)
I’ll mark this as the solution, but if you have any follow-up questions, let me know!