System harmonic impedance is the key parameter of harmonic emission level estimation and responsibility division. The traditional estimation method is usually suitable for the condition that the system impedance is constant and the background harmonic voltage fluctuation is small. However, changes in operation mode, switching impedance and other factors will lead to changes in system impedance, and resonance, fault and other phenomena will cause a large range of fluctuations in the background harmonic voltage. Therefore, a method for estimating system harmonic impedance based on DBSCAN clustering and data filtering is proposed in this method. When the system impedance changes, DBSCAN clustering can separate data clusters corresponding to different impedance values. When the background harmonic voltage has a large range of fluctuations, the data screening is beneficial to retain the data segment with small fluctuation of background harmonic voltage. Finally, robust regression method is used to calculate the harmonic impedance of the system. The simulation results show that the proposed method can suppress the influence of the system impedance change and the background harmonic voltage fluctuation.