K-means clustering is a machine learning algorithm used to group the data based on the similarity between the data. Functional distances like squared Euclidean distance, city block, cosine, correlation and hamming are considered as a similarity parameter here. Test vectors are grouped based on the functional distance using the K-means algorithm. A simple reordering algorithm is proposed and is applied to each group of data before 'X' bit filing to minimize the test power. Experimental results on ISCAS 89 benchmark circuit shows that the proposed methods diminish the power effectively.