Your term $\binom{17}{5}$ counts all choices that leave out Z. The term $\binom{10}{5}$ counts all choices that leave out Y. Their sum double-counts the choices that leave out Z and Y, that is, consist of members of X alone. So we must subtract $\binom{7}{5}$ to get rid of the double-counting.
Your sum also double-counts the choices where only Y is represented. So we must also subtract $\binom{10}{5}$ from the sum. There are no choices where only Z is represented, so no further adjustment is necessary.
**Remark:** The strategy was basic Inclusion/Exclusion, deliberate overcounting followed by adjustment.