I'll assume you're talking about Meguiar's Ultimate Compound (UC) and Ultimate Polish (UP). Although many will give you their suggestion/recommendation/opinion, and they might be different between different folks, the real answer is subject to your expectations and something that your eyes will tell you.
Here's what I mean...
If you are satisfied with your paint's appearance after the UC, then by all means, apply the wax and call it a day. If not, then do the UP step prior to the wax.
We all have varying degrees of expectations and varying degrees of perceived perfection. With that in mind, how much effort do you want to expend to meet your own expectations. Is the additional step going to increase your satisfaction?
Sorry for the lesson in psychology LOL.
I should have simply answered "yes". It's ok to do as you posed.
And for my final thought... Is the UC necessary? You could substitute UP for UC in your 2nd step unless you have defects that require the use of the UC.