When we do electronic configuration of that element having atomic number 12, it will be 2, 8, 2.
First 2 electron fills in the first shell, then 8 electron will occupy in second shell and finally, left 2 electron will go in third shell.As the last electron goes to third shell, so the element is in 3rd period.
Here, outer most electron is 2 , so it is also called valence electron, so the element is in 2nd group.
Hence the position will be, 3rd period, 2nd group ( element is Mg)
Hope now you understand the actual concept of finding the position.