Questions tagged [percentile-cont]

21 questions
0
votes
1 answer

Is this a valid PERCENTILE_CONT SQL query?

I am trying to run a SQL query to find a 50th percentile in a table within a certain group, but then i am also grouping the result over the same field. Here is my query, for example over the tpch's nation table: SELECT regionkey, …
Rafay
  • 92
  • 8
0
votes
0 answers

How to get Median of column x within each percentile in sql?

Is there a code in sql that will allow me to get a median of column x within each percentile I pulled in one select statement? Here is the percentiles I pulled. I am trying to avoid coding the median individually and merge them together. …
0
votes
1 answer

Trying to find the median of a sum in SQL Server

I am trying to find the monthly median of my category EVS. To do this I need to summarize all the events of each logical device name. However, This needs to be done on a monthly basis. I have two queries the first one, which I will paste below…
0
votes
0 answers

Percentile function using time in Access

I'm trying to calculate the 90th percentile of travel time for districts. I'm using MS Access. SELECT DISTINCT District As District_Num, PERCENTILE_CONT(0.9) WITHIN GROUP (ORDER BY Travel_Time) OVER (PARTITION BY District) AS 90th_Percentile FROM…
0
votes
1 answer

SQL: How to perform PERCENTILE_CONT of group sum among groups?

Very simply, let's say I have want to SUM the total of a feature within a group. So I partition over a window function: SELECT sum(NumberOfPlayers) over (partition by sport) as SumOfSport Great, this is good. Now.. I want to know the percentile of…
Union find
  • 7,759
  • 13
  • 60
  • 111
-1
votes
3 answers

how to avoid calling percentile_cont twice in a case clause to replace null with zero?

I need to calculate the median transaction amount for each customer in the past 52 weeks, but percentile_cont returns NULL if there's no transaction for a particular customer. In such a case, I have to replace NULL with zero, I acheived this by…
Arash
  • 141
  • 10
1
2