A randomized controlled trial finds that magnesium is important for modulating vitamin D levels by both increasing and lowering them.
“Both in vitro and animal studies have indicated that magnesium deficiency affects enzymes which synthesize and metabolize vitamin D metabolites. Based off of recent NHANES data ~45% of the US population does not meet the daily requirement for magnesium which is 310 mg/day for adult females and 400 mg/day for adult males.”