Dynamic groups help you manage group memberships more efficiently.
Members of a dynamic group are automatically added or removed depending on whether their account attributes match conditions that you define. In This video I have created a dynamic group and specified the condition to add all users which are based on Sales department.