p_EX is defined as the pipeline stage where ALU results are available. In your case it is stage 6 and not 3, so that your calculation should be
p_EX - p_ID - 1 = 6 - 2 - 1 = 3
The formula also applies if there are further IF stages, and even if there are several ID stages (you then take the last stage for p_ID).