Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Skip the ticket, Chat with Qlik Support instead for instant assistance.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Load Month End

Hello,

I am trying to load data from previous month end.  I am trying to use a variable so that it can run automatically without changing the date.

This does not seem lo work.

LET vPreviousMonth = addmonths(max(Today()),-1);


SELECT $(vPreviousMonth);


LOAD .... 
   
SQL SELECT *
FROM ...File
WHERE "posting date" <= $(PreviousMonth);



6 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

LET vPreviousMonth = Date(addmonths(max(Today()),-1), 'DD/MM/YYYY';


LOAD .... 
   
SQL SELECT *
FROM ...File
WHERE "posting date" <= '$(PreviousMonth)';

Anonymous
Not applicable
Author

I am still getting a syntax error when trying to load.

Anonymous
Not applicable
Author

Hi,

If you need monthend then use:

LET vPreviousMonth = monthend(addmonths(Today(),-1));

MK_QSL
MVP
MVP

Try this...

LET vPreviousMonth = Monthend(Today(),-1)

Your load statement

SQL Select * from ......

WHERE DATE(YourDate),'DD/MM/YYYY') <= Date('$(vPreviousMonth)', 'DD/MM/YYYY');


Anonymous
Not applicable
Author

I'd use this:

date(monthstart(Today())-1)

Clever_Anjos
Employee
Employee

LET vPreviousMonth = date(monthend(addmonths(Today(),-1)),'YYYY-MM-DD');


SELECT $(vPreviousMonth);


LOAD .... 
   
SQL SELECT *
FROM ...File
WHERE "posting date" <= '$(PreviousMonth)';