Controlling empty or multiple selection in calculation groups

How to control the execution of DAX code when there are either multiple or empty selections of calculation items in calculation groups.