The pressure P1 at the top a dam and P2 at a depth h from the top inside water are related as:
P2 - P1 = hρg
Pressure at a point in a liquid is due to the weight of the liquid acting on the surface of any objects in the liquid.
P = ρgh
Therefore pressure acting at a distance h = pressure exerted by the water column above the point = P2 - P1 = hρg