Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Uygar-Hamburg
Contributor II
Contributor II

Loading last 3 months in load script Qlik Sense

Hi,

I am quite new to Qlik Sense so it would be great if

you could help me on this:

I have several tables that I load from a SQL database,

for one table I only want to load the last 3 months of the PODueDate (Format: 2/15/2021).

 

Thank you

2 Solutions

Accepted Solutions
stevejoyce
Specialist II
Specialist II

Set vNumMonthsToLoad = 3;

Let vMonthsToLoad = date(addmonths(Today(), -$(vNumMonthsToLoad), 'M/D/YYYY');  //Today date - vNumMonthsToLoad

 

 

SQL Select

  <fields>

From <db>

Where PODueDate >= '$(vMonthsToLoad )'

;

 

View solution in original post

stevejoyce
Specialist II
Specialist II

Great!  Please mark appropriate post as the solution so thread can be closed.

View solution in original post

6 Replies
stevejoyce
Specialist II
Specialist II

Set vNumMonthsToLoad = 3;

Let vMonthsToLoad = date(addmonths(Today(), -$(vNumMonthsToLoad), 'M/D/YYYY');  //Today date - vNumMonthsToLoad

 

 

SQL Select

  <fields>

From <db>

Where PODueDate >= '$(vMonthsToLoad )'

;

 

Uygar-Hamburg
Contributor II
Contributor II
Author

Thank you for your reply.

Just one more question, the data load editor does not show the table 

that I want to edit. It shows only SET commands.

So I need to add the script of the table that I want to change first and put this afterwards?

 

stevejoyce
Specialist II
Specialist II

You mean you have no script in your data load editor?  Choose your data selection and click the Select data button.  You can use the wizard to select your database/table and get the SQL instert script.

Digvijay_Singh

Looks like you have added tables using data manager, I don't use that often but I think you need to remove that specific table from data manager and add that manually in the script editor and use the method as explained by @stevejoyce 

Uygar-Hamburg
Contributor II
Contributor II
Author

Thank you all for your help, I have unlocked the automatically generated script and added this code and it looks good

stevejoyce
Specialist II
Specialist II

Great!  Please mark appropriate post as the solution so thread can be closed.