It was easy to find the solution with the DDL and sample data you posted (I had to run the original query to get the expected results).
The important thing is that you understand what's happening so you can mantain it and replicate it in other cases. If you need help with APPLY, take a look at these articles, search more information on the web or ask any questions here. 😉