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: 
Anonymous
Not applicable

load min date variable

Hi,

I have 3 different files with date field. I want to create variable, which equal to min date from 3 files.

Do you have any suggestion?

Thanks,

4 Replies
vivientexier
Partner - Creator II
Partner - Creator II

If your 3 files have the same structure they will concatenate with each other and it will be only one table in QlikView.

Then, you need to do this :

Date_min_selector:

LOAD

     Min(date_field) as Date_min

Resident your_table;

LET vDate_min = Peek('Date_min', 0, 'Date_min_selector');

Not applicable
Author

I am assuming they do not have the same data or you are not looking to concat them all. You use this code for each table:

     
MinDate1:
      
LOAD
            
Min(OrderDate)           AS MinDate1,
      
       RESIDENT           
Table 1;


Then:

     
LET vMinDate1 = NUM(PEEK('MinDate1', 0, 'MinMax'));

LET vMinDate2 = NUM(PEEK('MinDate2', 0, 'MinMax'));
LET vMinDate3 = NUM(PEEK('MinDate3', 0, 'MinMax'));

Then:

DateRange:

LOAD * INLINE [

DateName;Dates

Date1;vMinDate1

Date2; vMinDate2

Date3; vMinDate3

];

Then:

MinFinal:

       LOAD
            
Min(Dates)           AS MinDateFinal,
      
       RESIDENT           
DateRange;

And Lastly:

LET vMinDateFinal = NUM(PEEK('MinFinal', 0, 'Min'));

--- Hope this helps

Not applicable
Author

table1:

load * from table1;

table2:

load * fro table2;

table3:

load * from table3;

Min_table1:

LOAD

     Min(date_field) as Date_min1

Resident table1;

Min_table2:

LOAD

     Min(date_field) as Date_min2

Resident table2;

Min_table3:

LOAD

     Min(date_field) as Date_min3

Resident table3;

LET vDate_min_table1 = Peek('Date_min1', 0, 'Min_table1');

LET vDate_min2_table2 = Peek('Date_min2', 0, 'Min_table2');

LET vDate_min3 _table3= Peek('Date_min3', 0, 'Min_table3');

Anonymous
Not applicable
Author

Thanks guys for helping me.

I got it, if I have only 2 date variables

VMinDate=Date(min(date(vMinDate1,vMinDate2)))

I need 1 variable, which shows min date from 3 others date variables.

They have different structures.

Regards,