How is the the turning error of an aircraft magnetic compass calculated?
First of all, in real life the overshoot will depend on the bank angle, so it is not really practical to do calculations unless you are doing some kind of special, precision flying or acrobatics. Normally you just get a feel for the overshoot and compensate intuitively. Exact calculations can be useful if you are doing precise figure-8's or something like that.

To actually do the calculation (which is based on a shallow turn 15-degrees to 20-degrees):

Target heading:

270 or 090 no correction necessary
northerly -- need to overshoot
southerly -- need to undershoot

Amount of correction (as variation from East/West parallel):

90-degree difference (eg heading 000) -- use 30-degree correction
60-degree difference (eg heading 330 or 030) -- use 20-degree correction
30-degree difference (eg heading 300 or 060) -- use 10-degree correction

Example 1:

You are on a 110 heading and want to turn to 030. You need a 20-degree overshoot. Turn left and roll out when you reach heading 010.

Example 2:

You are on a 335 heading and want to turn to 240. You need a 10-degree undershoot. Turn left and roll out when you reach heading 250.