Hi Monissha,
Have you assigned the Analytic privilege you have created to the Corresponding user?
Security->Users->Click on Analytic privilege and add that analytic privilege here.
You can also refer the below document where in i have explained the complete steps.
Dynamic SQL Analytic Privilege in SAP HANA
Regards
Priyanka