Common Table Expression (CTE) is a bit of a misnomer because it's not a table but rather a query. It straightforward to declare and easy to use with another queries. If you're not familiar with CTE this is worth a quick look.
CTEs are persisted temporary data sets, that allow you to store a single query to go back to later in your script. They're underrated compared to the subquery, that seems to be what most analysts around me use. Here's why I prefer to use CTEs when building SQL queries.