Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
Valued Contributor III

Re: How to get the last 10 record of table?

HI Kabilan,

Try the attach method.

Deepak

6 Replies
jason_michaelid
Honored Contributor II

Re: How to get the last 10 record of table?

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

MVP
MVP

Re: How to get the last 10 record of table?

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

Re: How to get the last 10 record of table?

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

Re: How to get the last 10 record of table?

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
Valued Contributor III

Re: How to get the last 10 record of table?

HI Kabilan,

Try the attach method.

Deepak

Not applicable

Re: How to get the last 10 record of table?

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.

Community Browser