Mendel determined that this was because yellow was a recessive trait which only appeared when green, the dominant trait, was not present.
He determined that the dominant trait would be displayed whether or not the recessive trait was there.