The dimensions of 1/2 mv2 are M.(LT–1)2, or ML2 T–2. (Remember that the numerical factors have no dimensions.) The dimensions of mgh are M.LT–2.L, or Motion, Force and Energy ML2 T–2. Clearly, the two expressions are the same and hence represent the same physical quantity.
Let us take another example to find an expression for a physical quantity in terms of other quantities.