Count within many to many relationship
I am trying to solve below problem and was seeking help for an optimal way.
I have a module which has a many to many relationship between Employees and Offices. I want a count of all unique employees within 1 office. For example in the below scenario, I have 3 offices with employees working from that office (1 employee can work from multiple offices). There is also a condition applied for each employee, only if that is satisfied the employee should be eligible for the count.
I am expecting to get the count as below