Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
soha1902
Creator
Creator

Last 5 records

Hi all,

I am loading data from excel sheet and this excel get updated in every 5 minute. Data is look like as below:

DateValue1Value2
5/9/2016  3:15:47 AM2530
5/9/2016  3:20:47 AM2723

Now I want to load last 5 records. I know about first 5 but there is no Last 5.

Can anyone help me.

Thanks.

8 Replies
Mahamed_Qlik
Specialist
Specialist

Hi Soha,

You can use the logic of incremental load with update.

Incremental Load in Qlikview - Sources

Hope it helps you better.

Regards,

Mahamed

Kushal_Chawda

Data:

LOAD Date,

           Value1,

           Value2

FROM Table:

New:

noconcatenate

First 5 LOAD *

resident Data

order by Date desc;

drop table Data;

PrashantSangle

Hi,

Logic can be Load table with descending order and load first 5

Kind Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
soha1902
Creator
Creator
Author

Is there any way where we will load only last 5 records from excel. This solution is correct but here first we need to load all the records, assume later stage when lacs of record is there then it will take time load.

Kushal_Chawda

Yeah but you cannot load the last five data directly without loading them all and perform sorting . You can directly load 5 records but it will pick random 5 records which will not be the correct solution.

Kushal_Chawda

or you can perform the descending sorting on Date in excel itself and then directly load first five records like below

Data:

First 5 LOAD *

FROM Excel

MK_QSL
MVP
MVP

May be like this..

Temp:

Load

  Count(Distinct RecNo()) as Total

FROM

Test.xlsx

(ooxml, embedded labels, table is Sheet1);

Let vTotalRows = (Num(Peek('Total', 0, 'Temp'))-2);

Drop Table Temp;

Final:

LOAD * FROM

Test.xlsx

(ooxml, embedded labels, table is Sheet1)

Where RecNo() >= $(vTotalRows);

Let vTotalRows = Null();

Mahamed_Qlik
Specialist
Specialist

Hi Soha,

It is possible, If you have any last updated date column into your excel file then you can filter your first data using this date field so that the required data only will get loaded.

Regards,

Mahamed