Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get the last 10 record of table?

Hi all,

I want to know how to get the last 10 or more record of table?

Please help me.

Thanks in advance..

Regards,

Kabilan K.

1 Solution

Accepted Solutions
deepakk
Partner - Specialist III
Partner - Specialist III

HI Kabilan,

Try the attach method.

Deepak

View solution in original post

6 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

If you are using v11 you can use dimension limits. If not, try Rank() with Aggr(). Maybe something like,

Aggr(If(Rank(Sum(Sales))>=Max(Rank(Sum(Sales)))-10,Customer),Customer) as your dimension.

Hope this helps,

Jason

jagan
Luminary Alumni
Luminary Alumni

Hi,

To get last 10 records of a table in script you can use First attribute and by using Order the table in descending order.

TableName:

First 10 Load

*

from abc.qvd

Order by Id desc;

Hope this helps you.

There is no direct way to get last 10 records.

Regards,

Jagan.

Not applicable
Author

Hi,

I am using V11, So tell me about dimension limit.

Because, my table doesn't have a any numeric column So This expresion is not work (Aggr(If(Rank(Sum(Sales))>=Max(Rank(Sum(Sales)))-10,Customer),Customer)).

Table is like this:

LOAD @1 as FirstDate, //this field have a date, Some dates are very and some dates are same

                                                                                               @2 as Information, //this field have string as 'Information'

                                                                                               @3 as Basedate // This field have Date and some string value

                                                                                             

                                                                                          FROM

                                                                                          [$(FoundFile)]

                                                                                          (txt, utf8, no labels, delimiter is '\t', msq);

Here, how can I get the last 10 record?

Thanks in advance.

Regards,

Kabilan K.

Not applicable
Author

Hi Kabilan,

You can add the RowNo() function in the table and based on that you can get the max rowno() and in the expression if you write RowID-10 then you will get the last 10 records.

Thanks,

Srini.

deepakk
Partner - Specialist III
Partner - Specialist III

HI Kabilan,

Try the attach method.

Deepak

Not applicable
Author

Hi,

It is fine. But may be it will give a performance issue if I have a lot of txt file

each txt file have 1,00,000 of records.

But we want the 10 records only.

In your sample we have to load the all records and from that we have to take the 10 records.

So, Is possible to solve this another way?

Thanks in advance..  

Regards,

Kabilan K.