Questions tagged [top-n]
322 questions
0
votes
0 answers
DAX TOPN formula works on 1 PC but not on others
I have a calculated measure in a Power Pivot data model in excel that has so far worked for me and my co workers.
=FIRSTNONBLANK(SELECTCOLUMNS(TOPN(1,searchpulse_,searchpulse_[comp_impr],0,searchpulse_[sp_match_key],0),"-",searchpulse_[Most Recent…

Sergei Trunov
- 165
- 9
0
votes
2 answers
How could I query from the first n rows using SQL?
For example, I would like to query from the first 10 rows, how could I achieve that. (Not get the first 10 of the query results).
I tried using 'limit' first then 'where' but it doesn't work.

Danni Chen
- 343
- 1
- 3
- 14
0
votes
0 answers
Show all columns with rank
Is it possible to show all the columns of the table in oracle along with the column that will show distinct rank like using dense_rank()? If yes please do let me know the solution.

Jaspreet Singh
- 155
- 1
- 10
0
votes
1 answer
Need explanation regarding the working of a self-join query on same column
Question is to find the 2nd highest salary of the emp table using self join.
The code is as below :
SELECT DISTINCT sal FROM emp e1
WHERE 2 = (SELECT count(DISTINCT sal) FROM emp e2 WHERE e1.sal <= e2.sal);
Can someone please explain the mechanism…

AlienDarkside
- 1
- 3
0
votes
3 answers
How to find most frequent value in SQL column and return that value?
I was trying to do something like this:
select nume_produs
from incasari
group by id
having count(nume_produs) = max(count(nume_produs));
but it doesn't work

ioio79
- 29
- 1
- 4
0
votes
4 answers
SELECT 50 MAX FIRST PRICES without a "WHERE" clause
how to select the first maximum prices in a table without using the clause "where" ?

Sara
- 353
- 1
- 3
- 13
0
votes
1 answer
why does both the block number is shown when I want to show the block with maximum departments?
I have a table department with 3 column(department_name , department_id, department_block_number) so I want to fetch the department_block_number in which maximum number of department is located ? I have two department_block_number 303, 202 and each…

sAnskar modi
- 1
- 2
0
votes
0 answers
Is there another operator - other than rownum - in Oracle to display the top result in a query
I'm new to coding,please keep that in mind,currently I'm learning in Italian, therefore are some mistake in spelling.
I have a small Database regarding a dvd-rental, I write this code and the result is nicely showing, but I need only the top…

roland.adrian
- 1
- 1
0
votes
2 answers
select only one name from multiple/many names
I want to select only one name from table where the person(name) is the most times in the table..
table looks like (the import_rec ix_k) :
product_name product_id man_name
product1 1 mame1|''|last_name1|''|ID
product2 …

Georgy
- 428
- 2
- 16
0
votes
2 answers
Best way to list top 5 large numbers from a huge text file
Trying to find best and simple way to list the top 5 numbers from a 150G text file.
The file I was searching has only numbers in in each line as below.
456789876
098765
36
48987
4509876
.
.
.
Tried the below program and still it displayed only…

yog raj
- 147
- 2
- 10
0
votes
1 answer
Power BI - Word Cloud - Top N Words
I have a question regarding "Word Cloud" custom visual. Let's say in my table, I have a column for "Keyword", "Cost" and "Clicks". I then create the following measures:
[Total Cost] = SUM(Table[Cost])
[Total Clicks] = SUM(Table[Clicks])
[CPC] =…

Shiv Konar
- 67
- 2
- 6
0
votes
4 answers
In mongodb how to get the highest count of salary
In Mongo db I have some sample data as follows:
Object 1
{
'id': 1,
'name': 'ram',
'age': 25,
'group': 'developer',
'salary': 30000
}
Object 2
{
'id': 2,
'name': 'sai',
'age': 27,
'group': 'developer',
'salary': 45000
}
This is some…

Anjansai
- 47
- 6
0
votes
1 answer
Rank () function over multiple columns in oracle
I need to rank a table with two columns transID & travel_date
here is my data
transID travel_date
2341 2018-04-04 10:00:00
2341 2018-04-04 11:30:00
2891 2018-04-04 12:30:00
2891 2018-04-04 18:30:00
2341 2018-04-05…

jatsen
- 39
- 1
- 1
- 8
0
votes
1 answer
how to make top_n() reactive? with using input$x inside the function?
I am building a shinyapp, and I have data for markets and customers.
I want to make a valueBox, that tells the Top Markets of the company,
but I want that the user chooses how many markets he wants to see (5,10,15,20, etc)
For example, to select…

Jana Zuraik
- 11
- 6
0
votes
4 answers
Oracle SQL Finding the 5 lowest salaries
I am trying to answer the following question. Show ID_Number and name for the five lowest paid employees.
This is the table with employees:
CREATE TABLE Employees
(ID_No CHAR(4) NOT NULL,
Name VARCHAR(50) NOT NULL,
…

Alexandru Petrea
- 85
- 1
- 10