Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Conditional Load in Script

Hi,

I need suggestions from you.

I have a Date, Quarter columns.

Date with 2009 to 2014 Years, and Quarters respective (2009 Q1,Q2,Q3,Q4) to 2014( Q1,Q2,Q3,Q4)

now I need to optimize my application with only latest 10 Quarters i.e (2014 (4QUarters) + 2013(4Quarters) + 2012 (2 Qurters(Q3,Q4)Every time my app should load only latest 10 Quarters of Data.

suggest me on this

12 Replies
anbu1984
Master III
Master III

Attached file Query.xlsx has only 6 quarters

jagan
Partner - Champion III
Partner - Champion III

Hi John,

Your file is having only 6 quarters of data, please verify your file.

Regards,

Jagan.

daveamz
Partner - Creator III
Partner - Creator III

Hi John,

It is very simple. Last 10 quarters actually means last 30 months. So, you can calculate 30 months back from today, than use this var in WHERE clause.

//Last 10 quarters = last 30 months:

LET vLastQuarters = MonthStart(AddMonths(Today(), -30));

Data:

LOAD CALENDAR_DATE,

     Alt(Date(CALENDAR_DATE), Date(Date#(CALENDAR_DATE, 'DD/MM/YYYY')))  as Date, //some values are in DD/MM/YYYY format.

     number_format,

     QTR_CD,

     YY_CD

FROM

Query.xlsx

(ooxml, embedded labels, table is Sheet1)

Where Alt(Date(CALENDAR_DATE), Date(Date#(CALENDAR_DATE, 'DD/MM/YYYY'))) >= $(#vLastQuarters);

Regards,

David