Elements in the same group of the periodic table typically have the same number of valence electrons and thus exhibit similar chemical properties, including the same common valency. Magnesium (Mg), Calcium (Ca), and Barium (Ba) are all in Group 2, and they tend to lose their two valence electrons to form ions with a +2 charge. Their valency is 2.