Magnesium deficiency is not common.
It can be tested by measuring blood Mg2+ levels - the reference range is 1.5-2.0 mEq/L and levels less than 1.0 mEq/L are a matter of concern
Magnesium: Reference Range, Interpretation, Collection and Panels .
The RDA for Mg2+ for adults is in the range 300-400 mg/day. Good dietary sources of Mg2+ include cereals, green vegetables, fish and nuts. Most people can meet their Mg2+ RDA from dietary sources. People who choose to eat Mg2+ as a supplement without medical supervision should note that tolerable upper intake level for supplemental magnesium is 350 mg/day - eating more than that as a supplement can have adverse health outcomes (
Magnesium | Linus Pauling Institute | Oregon State University).