Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load top n records


Hi

How do i load only top 5 records in qlikvew?

1 Solution

Accepted Solutions
vivek_niti
Partner - Creator
Partner - Creator

Hi,

Use the keyword FIRST before LOAD.

tab1:

FIRST 5 LOAD *

FROM ...........

View solution in original post

7 Replies
MK_QSL
MVP
MVP

Test:

Load Customer, Sales From TableName;

Left Join

Load Customer, SUM(Sales) as TotalSales Resident Test Group By Customer;

Noconcatenate

Final:
Load Customer, TotalSales Resident Test Where RowNo() <=5 Order By TotalSales Desc;

Drop Table Test;

vivek_niti
Partner - Creator
Partner - Creator

Hi,

Use the keyword FIRST before LOAD.

tab1:

FIRST 5 LOAD *

FROM ...........

rajeshvaswani77
Specialist III
Specialist III

Hi Asma,

Use

table1:

FIRST 5 LOAD *

FROM ...........Tablename order by fieldname

Thanks,

Rajesh Vaswani

Not applicable
Author

JUST ADD

First N to a LOAD or SELECT statement , where N is the first number of records you want to load .

alkesh_sharma
Creator III
Creator III

Try this:

ON the script editor, select Debug -> limit load -> 5 -> start

its_anandrjs

Hi,

For finding Top 5 in the front end try this

Assume this example

Source:
LOAD * Inline [
Centers,Sales
A,98521
B,65823
C,32581
D,1587
E,12635
F,8426
G,12563
H,2569
I,78451
J,25638
K,45821
L,15896
M,1263
N,25874
O,7845
P,12589
]
;

Dim:-  =if( Aggr(Rank(Sum(Sales)) <= 5,Centers),Centers)
Expre:- Sum(Sales)

Or In script you can

Source:
LOAD * Inline [
Centers,Sales
A,98521
B,65823
C,32581
D,1587
E,12635
F,8426
G,12563
H,2569
I,78451
J,25638
K,45821
L,15896
M,1263
N,25874
O,7845
P,12589
]
;
Left Join
Load Centers, SUM(Sales) as Total Resident Test Group By Centers;
Noconcatenate
First 5
Final:
Load Centers, Total Resident Source
Order By TotalSales desc;
Drop Table Source; 

Regards,

Anand

Harish_zreddy
Contributor II
Contributor II

Hi, 

    If i use this FIRST 5 LOAD * I am getting qvx file error. If there is only one table, it is executing but if there are more than one table it is not executing. Can you please provide the solution for this.