Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rammuthiah
Creator III
Creator III

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

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

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

RicardodelaRosaQlik

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

Try This,

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

Thanks & Regards,

Ashwini

ashwinishinde
Partner - Contributor III
Partner - Contributor III

Try This,

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

Thanks & Regards,

Ashwini

jonathandienst
Partner - Champion III
Partner - Champion III

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

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