# Z transform piecewise function

I have this piecewise function:

$$x(n)= \left\{ \begin{array}{lcc} 1 & 0 \leq n \leq m \\ \\ 0, &\mbox{ for the rest} \\ \\ \end{array} \right.$$

How do I calculate the $z$-transform?

$X(z) = \sum_{n=-\infty}^{\infty}x[n]z^{-n} = \sum_{n=0}^{m}z^{-n} = \frac{1-z^{-(m+1)}}{1-z^{-1}} = \frac{1}{z^{m}}\frac{z^{m+1}-1}{z-1}$, with $z \neq 0$.