Questions tagged [top-n]

322 questions
2
votes
3 answers

Display the name and max age

Possible Duplicate: How to display the record with the highest value in Oracle? I am supposed to display the name and age of the oldest person from the database. The code I used displays the name and the calculated age of several people, but it…
Johnny Nguyen
  • 39
  • 1
  • 6
2
votes
2 answers

How to display the record with the highest value in Oracle?

I have 4 tables with the following structure: Table artist: artistID lastname firstname nationality dateofbirth datedcease Table work: workId title copy medium description artist ID Table Trans: TransactionID Date Acquired Acquistionprice datesold…
2
votes
1 answer

Oracle SQL: Show n rows for each id

I have a table with 2 columns, ID and URLS, for each ID there are several URLS. I want to extract only 5 maximum URLS per ID. How do I go about doing this in Oracle SQL?
anon
  • 1,101
  • 3
  • 17
  • 33
2
votes
3 answers

Top N query performance when accessing a list of IDs

I have a top N query that is giving me problems. First of all, I have a query like the following: select /*+ gather_plan_statistics */ * from ( select rowid from payer_subscription ps where ps.subscription_status = :i_subscription_status …
Stephen ODonnell
  • 4,441
  • 17
  • 19
2
votes
1 answer

Average of Top n per Group SQL Server

I'm working on a problem of finding mean processing times. I'm trying to eliminate outlier data by essentially performing a average on only the best 80% of the data. I am struggling trying to adapt existing Top N per Group solutions to perform…
Eric Alan Hill
  • 165
  • 1
  • 8
1
vote
1 answer

what is topN in nutch 1.3?

I read in sites that nutch fetch links from every link equls to topN.I have 4 links but when nutch crawl my links, all result that returned with nutch are equals topN. it means if i have 4 links and topN = 10, nutch fetch 10 links from all links not…
helen
  • 29
  • 1
  • 5
1
vote
2 answers

Power Bi: Top N visual level filter as Measure

Need a measure that will provide the same output as TopN visual level filter (than I can parameterize it). The solution for simple cases provided HERE But it doesn't work for more complicated cases... EXAMPLE: Don't work if you add any dimension…
Denis
  • 625
  • 1
  • 8
  • 28
1
vote
2 answers

Select rows from Spark DataFrame based on a condition

I have two Spark dataframes: df1 +---+----+ | id| var| +---+----+ |323| [a]| +---+----+ df2 +----+----------+----------+ | src| str_value| num_value| +----+----------+----------+ | [a]| ghn12| 0.0 | +----+----------+----------+ | [a]| …
Hilary
  • 475
  • 3
  • 10
1
vote
0 answers

Tableau Top N set to 10 of group set is showing more than 10

How can I get top 10 results of my longest rides to date or filter the results to grab distinct string which would be the [Title] of the bike ride? Is there a custom formula I can enter? My result is showing two results for Ride 1 and Ride 6 which…
sloga
  • 612
  • 2
  • 12
  • 31
1
vote
1 answer

How to use an output of a query as a where parameter in a second query

I have this query to list top_10lead segments: select segment as "Segment", count(*) as "Qty" from table where id >=1 group by segment order by 2 desc limit 10 Now I want to use the first segment in the query above (limit 1 desc) to use in a where…
pouchewar
  • 399
  • 1
  • 10
1
vote
0 answers

DAX -- Cannot get TOPN formula to give me sum of the top n

I've spend hours pouring over documentation on SUMMARIZE, SUMMARIZECOLUMNS, ADDCOLUMNS AND TOPN, and I just cannot get this simple calculation to come out correctly. I've even looked at results with DAX Studio, and it's always wrong. I'm trying to…
Freond
  • 64
  • 10
1
vote
0 answers

How can I find the latest completed date that is before a date in SQL Server

Using SQL Server, I am trying to get the latest date a client completed an assessment that is less than the current date (or census date in this case). This query should roll through every day of the client census, and if the client is on the census…
Dcrow01
  • 21
  • 2
1
vote
2 answers

Power BI topn function: Problem with topn function returning more than n rows due to duplicates

This is the current data table that I have, which is called 'Potential High Usage' CLICK TO SEE DATA TABLE I tried to use the TOPN function to create a table of the top 10 'User ID' based on the 'Number of clicks'. This is how I tried to do it: High…
Amy Qutaish
  • 11
  • 1
  • 3
1
vote
1 answer

How to do poll values from Priority queue based on a condition

I have map Map where the queue is ordered based on the score (reverse). I populated the map from a List where key being data.getGroup and value being Dataitself. Now my usecase is, if the size of the map is <=3, I just want…
user3407267
  • 1,524
  • 9
  • 30
  • 57
1
vote
1 answer

PBI DAX Query for Top N to return Text

I am trying to write a DAX query to return the Vendor Name (data type is text) with the highest sales. I have a query that returns the sales amount for the vendor with the highest sales, but I need the opposite of this. I have tried just doing the…
courty340
  • 101
  • 3
  • 16