linenup
Mineral antagonism is likely the cause and by this I mean that magnesium might be interfering with the other minerals such as potassium, sodium or calcium.
Best to do a hair mineral analysis, I think Trace Elements is best for several reasons. It is possible that it may be affecting vitamin status as well.
Last possibility is that the form of magnesium is not right for you. Magnesium comes in different formulations and every one can react differently in the body. I personally like Doctor's Best High Absorption which is mag lysinate and mag glycinate. Others report good results with this formula.