For s and p block we can determine the valence electrons easily,but what about d-block elements. How to determine their valence electrons?
Based on the Aufbau principle, they would all be filling the (x-1)d sublevel, so they would ALL have 2 valence electons in the xs sublevel.
Since the Aufbau priniciple fails to account for the fact that some elements will be more stable with incomplete valence xs sublevels and additional electrons in the (x-1)d sublevel, you just need to memorize the transition metals that are more stable with 1 valence s electron:
Chromium, Possibly Nickel, Copper, Niobium, Molybdenum, Ruthenium, Rhodium, Silver, Platinum and Gold,
And the two extra specials:
Palladium which prefers to fill the x-1d sublevel and not put any in the xs sublevel. It has 18 in its highest energy level, level 4, but only the 10 4d electrons are considered to be valance electons.
And Lawrencium which has 7s2 (5f14) xp1, or 3 valence electrons, putting 1 electron in the xp sublevel rather than in the (x-1)d sublevel. It turns out to be a d-block element that is not filling the d-block.
Notes This will give you the number of electrons in the highest energy level for transition metals. Transition metals in the highest d sublevel (but not in the highest primary energy level) can provide valence. Many sources will refer to all of the electrons above the configuration of the prior noble gas to be valence electrons.
On one hand, most of the oxidation states for transition metals have been observed, up to the point where they would have lost all of those d electrons.
On the other hand, the d electrons in transition metals are not de-localized in metallic bonding of transition metals (to the best of my knowledge).