Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Loading selective data based on period

Hi ,

I have source data which is like

MAY-2018,1,2,3,4

APR-2018,1,2,3,4

DEC-2017,1,2,3,4

If current month is JULY-2018 then I want to avoid loading data older than 6+1 month hence in the loading I want to avoid loading DEC-2017 entry.

thanks,

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Where Date#(Date,'MMM-YYYY') >= AddMonths(Today(),-7);

View solution in original post

6 Replies
olivierrobin
Specialist III
Specialist III

hello

try something like

let a=date(today(),'MMM-YYYY');

let b=date(addmonths(a,-6),'MMM-YYYY');

and in you load, add a where clause

DateLoad>=b;

Anonymous
Not applicable
Author

Hi, Does it not require to convert the first column to the date format? Because I already tried the above method but it is loading 0 rows i.e. nothing.

Anonymous
Not applicable
Author

I did try something like below in the where clause but it didn't work.

Where Date(MONTH&'-'&YEAR,'MMM-YYYY') >= date(AddMonths(Today(), -7),'MMM-YYYY');

sergio0592
Specialist III
Specialist III

Try with :

Where Date(Date#(MONTH&'-'&YEAR,'MMM-YYYY')) >= AddMonths(Today(),-7) ;

tresesco
MVP
MVP

Where Date#(Date,'MMM-YYYY') >= AddMonths(Today(),-7);

Anonymous
Not applicable
Author

both solutions are working.