Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

only load first date of every item

hi com,

i want the load script to only load the first date out of several which all have the same characteristics besides the date!


example


date     number     value

2/5          1               5

10/4        1               5

12/5        1               5


so i only want 2/5 to be loaded and not all


hope u can help me

15 Replies
maniram23
Creator II
Creator II

Hi,

please chech this one.

t1:

LOAD * INLINE [

Date   ,  number    , value

2/5     ,     1  ,             5

10/4     ,   1  ,             5

12/5      ,  1 ,              5

];

load *,

'' as zero

Resident t1 where Date=peek('Date',0,'t1') Order BY Date ;

DROP Table t1;

DROP Field zero;

Not applicable
Author

jep but these are just examples the date doesn't matter i just want the first delivery of a product at a location.

Not applicable
Author

hi mani,

thx for ur answer but pls check my add under jose's/arul's comment.

and my question is what u want to with ('' as zero ) or what do u mean with this.

jsenivifor
Contributor III
Contributor III

Hi Eric,

Let me send you the code with any changes, I've tried it and it seems to work.

temp:

NOCONCATENATE

load articlnumber,

     location,

    amount,

     Date_VD as delivery_date

Resident Vd_TAB

where "typ" ='delivery';

left join

load articlnumber,

     location,

     Date_VD as sale_date

     Resident Vd_TAB

where "typ" ='salef';

drop table Vd_TAB;

aux:

first 1 load min(date(delivery_date),'DD/MM/YYYY') as date_min

resident temp;

let vMin = peek('date_min',0,'aux');

Vd:

first 1 Load  articlnumber,

    location,

     delivery_date,

     sale_date,

     sale_date-delivery_date as diffdate

resident temp

where sale_date-delivery_date >=0 and delivery_date ='$(vMin)';

drop table temp;

Regards,

maniram23
Creator II
Creator II

Hi,

it will also work  "jose's/arul's comment ."


zero is new derived value..


that is not required thing.


when we are taking resident of all data of upper table. than it will not give proper data that so i was taken "NEW DERIVED VALUE"





Not applicable
Author

thanks for u help again.

But now there are some locations and articles with no diffdate and delivery/sale date.

I think the problem is at first 1 load because it only seem to load the first date it finds in the table.

So i tried around with firstsortedvalue, but then qlik sense gives out errors everytime.