In the relation
EP = kmgh,
The dimensions, of the term, on the left, are

On the right hand side, the dimensions, of the product of the three terms, on the right, are

The dimensions, on the two sides of the relation are thus seen to be the same. Hence the given relation is (dimensionally) correct.