Exposed does not support CTEs at this time. You can follow Exposed issue 868 to be kept up to date on this feature.
As a temporary solution, this adds CTE support to Exposed : https://gist.github.com/SalomonBrys/61fed3a1206d50e9865c3e76f274296b