We have multiple departments now how can we segment site visitors by the department?
Userid 1 dept 1
Userid 2 Dept 2
Userid 3 dept 1
then dept1 has 2 visitors
I guess the best solution would be a custom dimension to track the department for each visitor. See https://matomo.org/docs/custom-dimensions/ for more details about custom dimensions.
Otherwise you may need to create complex segments where you segment for each userid in a department using OR.