<span lang="EN-US">In this paper, a novel current controller for selective compensation with active power filter (APF) in a microgrid (MG) is proposed. Power generation with sinusoidal voltage and high quality is essential in the microgrid. Hence, a current control-based method for shunt active power filters aiming to compensate the selective harmonic is proposed. Also, voltage source converter is used in the APF to improve MG power quality. Using the suggested control method can reduce total harmonic distortion (THD). The obtained results from the MATLAB simulations proved the superior of our method than other methods to decrease the current harmonic in a microgrid to an admissible area. Additionally, the practical results obtained from the implementation of the proposed control approach on an actual microgrid confirm the efficacy of the proposed method.</span>