There is no need. There is no interference between Ca and Mg in XRF; their energies (and wavelengths) are different. Mg: Ka 1.253 keV and Ca Ka 3.692 keV.
You may see interference from As La (1.282 keV) on Mg Ka.
I agree that EDXRF spectra are clearly resolving the two elements mentioned. Chemical separation methods may have such problems as Ca and Mg can co-exist!
As noted in previous responses, the analytical lines are likely to be fully resolved between these elements. There may also be absorption/enhancement effects of one element on the other (matrix effects) that must be accounted for in order to achieve fully quantitative results. The matrix effects are probably most easily handled using appropriate software supplied by the instrument manufacturer. The best algorithm for matrix correction (fundamental parameters, alpha correction, etc) will depend on the details of the samples and the analytical problem.
I think its better to study a little bit about the fundamentals of XRF and not just use it as a black box. From your question it appears you have not got the idea how it works.
XRF is done through photon excitation-emission/fluorescence...which are atomic phenomena. Why Ca and Mg do not interfere Ian already explained. Please refer any standard Atomic Physics text book or other available literature. For you to understand the matrix effects (@Thomas mentioned above) and accordingly preparing your samples will also need you to know at least the basics.
We are analyzing Ferro silicon Magnesium alloy which contains Si(45%), Mg(10-5%),Fe(45%),Ca(2-4%),La(1-2%),Ce(2-3%), we are getting low value of Magnesium in XRF analysis when calcium amount is increasing in the alloy. When we are testing the same alloys by ICP method we are getting the correct values. Theoretically we know it should not interfere, but in Ferro Silicon Magnesium alloy the wave length of one element is interfering the other because of matrix effect and grain size of the alloy(Which depend cooling rate of alloy). I have posted this question for getting solution for interference because of matrix effect and grain size.
Ah! now you rightly place the question, and more vitally mention your sample type. Now, please let us know which quantification method you used. Is it standardless fundamental parameters (FP) or do you use empirical coefficients with similar matrix reference standards for calibration?
Generally, alloys are treated as homogeneous solid solutions and fundamental parameters (FP) is good enough. But if you feel the quick setting alloy causes grain size interference (unlikely) or some matrix interference you can go for empirical coefficients method if you have enough number of similar matrix ref. standards for calibration. Are you detecting Si in your instrument? What about the quantification of Si? Is it okay?
Are you using infinite thickness of sample in your input or intermediate thickness? If you do not input proper sample thickness the FP/emp. coeff. can overestimate the enhancement due to Ca-K X-rays on Mg-K X-rays and also underestimate absorption of Mg-K X-rays in Si.
Another possibility in your case is that if you are using the factory calibration for the FP method supplied with the XRF instrument, the detector efficiency can change with time due to depositions on the window. The effect. is that especially the efficiency of detection of low Z elements is reduced or lower energy (Mg-K X-ray in your case) sensitivity is reduced for the spectrometer. So if you have the expertize or standards recalibrate your instrumental efficiency or sensitivity.
Now you are the best person to think about the cause and its solution. All the Best.
Sorry the last possibility applies only for semi-conductor detectors used in EDXRF. I suppose you are using a WDXRF? The recalibration thing however applies whether you use FP or empirical coefficients.