Yes, $f=x$ almost everywhere wrt $P$. Consider the push-forward measure $\mu=f_*P$ (in probability, it is also called the distribution of $f$). It is defined as $\mu(E)=P(f^{-1}(E))$. This $\mu$ is a probability measure on $C$. Your condition becomes $$\int_C d\mu=x,\quad (1)$$ and this implies that $\mu$ is an atom at $x$. EDIT. This is a special case of a theorem of Bauer (see, for example Phelps, Lectures on Choquet's theorem, Proposition 1.4). Let $X$ be a non-empty compact convex set, and $x\in X$. Then $x$ is an extreme point if and only if the point mass at $x$ is the unique measure for which (1) holds. Of course, you did not say that $C$ is bounded, but the reduction to this case is easy.