23 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
1
answer
86
views
How Can I Match Percentile Results in Postgres and Pandas?
I am making calculations in the database and want to validate results against Pandas' calculations.
I want to calculate the 25th, 50th and 75th percentile. The end use is a statistical calculation so ...
0
votes
1
answer
249
views
Percentile over in a Window function in Amazon Athena
I am searching for a solution for a problem. I am working with Amazon Athena and i need a field that shows the percentile of days for a product between 2 timestamps. I have it working in Amazon ...
0
votes
1
answer
31
views
Calculating median values including all values in SQL
So i'm having trouble with calculating medians in T-SQL properly.
I've got a CTE that looks like this:
Medians AS (
SELECT
ParishCode AS PAR21CD,
ChangeDate AS 'Month Start',
...
1
vote
2
answers
1k
views
percentile_cont with aggregate Function
I'm using SQL Server 2012 and trying to calculate some aggregate functions and percentiles on a data set with two columns (id and time). In my research I found some solutions, but they don't work for ...
0
votes
1
answer
1k
views
How to use PERCENTILE_CONT in GROUP BY query?
I have a table named TabA with the following columns,
Id
Currency
Value
Institution
Expected Results:
Id Currency Cnt Median(Value) Institution
I am getting the values except Median(Value) ...
0
votes
1
answer
97
views
I want ntile(3) within ntile(3) as in subdivision within division by ntile()
I want to create a ntile(3) within an ntile(3).
I have the following table:
Customer
Total_amt
Digital_amt
1
100
45
2
200
150
3
150
23
4
300
100
5
350
350
6
112
10
7
312
15
8
260
160
9
232
150
10
190
...
0
votes
0
answers
279
views
Calculating Percentile on large SQL tables
I have a large SQL table with 100+ million records in SQL Server as follows:
+-----------+----------+----------+----------+----------+
|CustomerID |TransDate |Category | Num_Trans |Sum_Trans |
+-------...
-1
votes
3
answers
481
views
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 ...
1
vote
1
answer
741
views
PostgreSQL want to round percentile_cont
I am computing a range of values in PostgreSQL, and I want to round some of them to 2 decimal places. when I do round the average it works round(avg(rate), 2) as avg_rate. when I round the median ...
2
votes
1
answer
2k
views
Find median of dates in PostgreSQL
I was wondering if there is a way to find the 'median' date in PostgreSQL. The goal is to obtain, according to the median, the date that is in the middle of all the dates.
I tried following modified ...
1
vote
0
answers
352
views
Calling T-SQL's "PERCENTIlE_CONT" directly from EntityFramework Core
This SO question describes how to call DatePart function using EntityFramework:
I wonder if I can provide a similar binding for PERCENTILE_CONT.
Or maybe the only way to use PERCENTILE_CONT via ...
1
vote
0
answers
661
views
Multiple PARTITION BY ... OVER the same column in T-SQL
I found the following query in a book on T-SQL
SELECT
round(SUM(TotalDue),1) AS Sales,
LastName,
FirstName,
SalesPersonId,
AccountNumber,
PERCENTILE_CONT(0.4) WITHIN GROUP (ORDER BY round(SUM(...
0
votes
1
answer
295
views
How to calculate the number of rows (& their percentage) that fall below the 10th percentile of column in SQL?
I have a column with numbers. I already calculated the percentiles using percentile_cont. How can I sum up/count all the rows (& calculate their %) that fall below, e.g. the 25th percentile?
0
votes
1
answer
452
views
calculate percentile and use case when in sql
I have a data set
Cashback table
user | order_amount
-------+------------
raj | 200
rahul | 400
sameer | 244
amit | 654
arif | 563
raj | 245
rahul | 453
amit | 534
arif | 634
raj |...
user avatar
user16795956
0
votes
1
answer
1k
views
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 ...