Hubert-Dudek
Databricks MVP

You are referencing CTE inside of CTE. That's why it is not working. It would be best if you refactored your query.image.png


My blog: https://databrickster.medium.com/