Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our May 2021 end-to-end product release from Data Integration to Data Analytics is out! READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
rammuthiah
Creator II
Creator 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
Partner
Partner

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))

View solution in original post

7 Replies
surendraj
Specialist
Specialist

may be this

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

--Surendra j

shraddha_g
Partner
Partner

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))

View solution in original post

cjx
Employee
Employee

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
Partner
Partner

Try This,

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

Thanks & Regards,

Ashwini

ashwinishinde
Partner
Partner

Try This,

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

Thanks & Regards,

Ashwini

jonathandienst

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;

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst

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 (...)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein