How would you write a query to calculate the median or percentile of a metric for Applied Data Finance QA reporting?