In the light of the detection of the voltage sag in DVR, a novel integrated derivation detection algorithm based on dq transformation is presented after analyzing the existing dq transformation detection algorithm. This algorithm can be used to detect both the single voltage sag and the three-phase voltage sag. It can simultaneously eliminate the delay in the process of constructing the dummy three-phase system from the single system and that in the process of separating the direct current part under the dq coordinate system, while taking into account the influence of harmonics in the course of voltage sag. The simulation results show that the algorithm is easy to implement and has good real-time performance, so that it can meet the demand of DVR detection.