At work we're moving from Teradata to Spark SQL (Hadoop Cluster), so I need to convert many of my scripts.
Here is my original SQL script, and I am trying to get the 60th percentile of the cust. satisfaction rating (i.e. top 40% of performers) for each call centre team we have. I've tried variations of it online but i can't get it working:
***SELECT BSE.staffgrouplevel
,BSE.Sub_Region
,BSE.staffgroup
,Percentile_Disc(0.6) Within GROUP (ORDER BY BSE.CSAT ASC) AS CSAT_pct_q60
FROM P_IntegratedAnalytics_T.Q121_BPL_EmpTgtRawData3 BSE
INNER JOIN P_IntegratedAnalytics_T.Q121_60th_TOP_SCORE_FROM_PARTNER3 BSE2
ON BSE.STAFFGROUP = BSE2.STAFFGROUP
AND BSE.COMPANY = BSE2.COMPANY
AND BSE.CSAT_Sg_Comp_60 = BSE2.CSAT_Sg_Comp_60
WHERE BSE2.CSAT_Sg_Comp_60 = BSE2.Top_CSAT_Sg_Comp_60
AND BSE.CSATDen>=10
GROUP BY 1,2,3***
Any advice or suggestions on what I should use here?