WITH keyword direct query vs spice

Hello everyone, does anyone know if WITH keyword works with direct query + custom SQL for Athena data source?
I have a dataset that uses WITH keyword and when I tried to switch it to direct query (to use dataset parameters), it just gives the following error in my Analysis without any change to the SQL
But when I switch back to SPICE, the data will load fine.

Thank you

Hello @tsaiw,

Athena supports with statements when called from QuickSight

it is possible that there is something different than this that is causing the error. Can you show us the output of the “Show Details” to see if we get more information on the error?

@andress007, thanks for getting back to me.

My dataset shows the correct data as well. However, when used in Analysis, it shows the below error