Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
brucemazynzolt
Contributor II
Contributor II

How to refresh Part of code monthly

Hi Experts,

Below is the code trying to refresh, some part as monthwise based on if condition, Here If condition is satisfied then my code is working fine if not monthwise data is completely skipping.

what I am expecting is if month wise data IF condition is not satisfied then skip to next step, but already existing data(Month wise) should display. Just to avoid daily loading of Table1(Month wise data)

LET vEveryMonth = Num(MonthStart(today()));

If $(vEveryMonth) = Num(Today()) then


//Need to refresh once in a Month(start date of every month)

//Loading Month wise data
Table1:
Load * From Facttable.qvd(QVD)

WHERE DATE(floor(CalendarDate),'YYYYMMDD')<=date(floor(monthend(addmonths(Today(),-1))), 'YYYYMMDD');

Concatenate

ENDIF;

//Loading Daily Data

Table2:

Load * From Facttable.qvd(QVD)

Where DATE(floor(CalendarDate),'YYYYMMDD')>date(floor(monthend(Today(),-1)), 'YYYYMMDD

Thanks In Advance,

Bruce Mazyn Zolt - BMZ

2 Replies
prieper
Master II
Master II

Why do you need the vEveryMonth?

Condition may also work with

IF TODAY() = MONTHSTART(TODAY()) ...

If would prefer to have the WHERE-clauses not on strings, but on numbers.

WHERE FLOOR(CalendarDate) < MONTHSTART(TODAY())

should do as well?

The CONCATENATE in this position is not clear to me, Loading with * from the same table will automatically concatenate.

What do you wish to achieve with the second condition?

brucemazynzolt
Contributor II
Contributor II
Author

Hi Pete,


Thanks for your reply.

Here my intention using the same qvd is monthly summarising data from 1st qvd like the month should get completed from 1st qvd and  if the month is current month it should show only daily data from 2nd.

Concatenation god both qvd’s will get result like below sample.

Date.              Sales

Aug-2018       10000

Sep-2018        20000

Oct-2018        30000

11-01-2018.       210

11-02-2018.       400

11-03-2018.        320

.

.

Like wise until the current month gets completed should show in date wise .


I have achieved the report as per the requirement but only one thing here is I need to avoid the daily reload of 1st qvd means month qvd.


That’s why looking for load once in a month of month qvd.

As my IF condition is working only date gets matched else completely skipping the month qvd and not showing month data in report