Unable to Edit Custom SQL of a dataset

You can create a custom sql from the underlying datasource : Using SQL to customize data - Amazon QuickSight

Select the datasource (QS )
Click > Create dataset
Use Custom SQL