It sounds like you're on the right track for calculating the mean X - but you can possibly simplify it simply by dividing by the count when the for-each has finished, like:
+ Always
-> Set x_sum to 0
-> Set y_sum to 0
+ For each swarm_object
-> Add swarm_object.x to x_sum
-> Add swarm_object.y to y_sum
+ Always
-> Set mean_x to x_sum / swarm_object.count
-> Set mean_y to y_sum / swarm_object.count
Remembering events and actions are read in top to bottom order, this leaves you with the mean x and y in mean_x and mean_y.