Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

rammuthiah
Contributor II

Load recent 2 days data from excel

I have data for many date, I want to load only recent two days data. I tried loading  max(Date) and max(Date-1). But It is not working.

1 Solution

Accepted Solutions
shraddha_g
Honored Contributor III

Re: Load recent 2 days data from excel

Try

MaxDateTable:

Load Max(DateField) as MaxDate

From .....xlsx];

Let vMaxDate = num(peek('MaxDate',0,'MaxDateTable'));

Load *

From .....xlsx]

where date(DateField ) >=date($(vMaxDate)-1) and date(DateField ) <=date($(vMaxDate))

7 Replies
surendraj
Valued Contributor

Re: Load recent 2 days data from excel

may be this

max(date) & ' and ' & date(max(date-1))

--Surendra j

shraddha_g
Honored Contributor III

Re: Load recent 2 days data from excel

Try

MaxDateTable:

Load Max(DateField) as MaxDate

From .....xlsx];

Let vMaxDate = num(peek('MaxDate',0,'MaxDateTable'));

Load *

From .....xlsx]

where date(DateField ) >=date($(vMaxDate)-1) and date(DateField ) <=date($(vMaxDate))

cjx
New Contributor II

Re: Load recent 2 days data from excel

Hi,

you can use some functions like date(num(today())-2) or date(num(today())-2,'DD/MM/YYYY') if you need to format,

to compare the date column that you want to use for filter.

In this example I´m using today but you can use any date_column you have in your own table.
Regards,
Ricardo

ashwinishinde
New Contributor III

Re: Load recent 2 days data from excel

Try This,

=DATE(Max((Date)-1))

Thanks & Regards,

Ashwini

ashwinishinde
New Contributor III

Re: Load recent 2 days data from excel

Try This,

=DATE(Max((Date)-1))

Thanks & Regards,

Ashwini

MVP
MVP

Re: Load recent 2 days data from excel

If by "recent", you mean nased on the maximum date in the file:


Raw:

LOAD *

FROM excelfile.xlsx (...)

Max_Date:

LOAD Max(Date) as MaxDate

Resident Raw;

Let vMaxDate = Num(Peek('MaxDate'));

DROP Table Max_Date;

Final:

NoConcatenate

LOAD *

Resident Raw

WHERE Date >= ($(vMaxDate) - 1);

DROP Table Raw;

MVP
MVP

Re: Load recent 2 days data from excel

If "recent" means today and yesterday:

Raw:

LOAD *

FROM excelfile.xlsx (...)

Let vMaxDate = Num(Today());

Final:

NoConcatenate

LOAD *

Resident Raw

WHERE Date >= ($(vMaxDate) - 1);

DROP Table Raw;

Or even this:

Let vMaxDate = Num(Today());

Final:

LOAD *

WHERE Date >= (Num(Today()) - 1);

LOAD *

FROM excelfile.xlsx (...)

Community Browser