To factor $ 2xy-2y-x^2+x $ we can use factoring by grouping.
Group $ \color{blue}{ 2xy }$ with $ \color{blue}{ -2y }$ and $ \color{red}{ -x^2 }$ with $ \color{red}{ x }$ then factor each group.
$$ \begin{aligned} 2xy-2y-x^2+x &= ( \color{blue}{ 2xy-2y } ) + ( \color{red}{ -x^2+x }) = \\ &= \color{blue}{ 2y( x-1 )} \color{red}{ -x( x-1 ) } = \\ &= (2y-x)(x-1) \end{aligned} $$