Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vvaldez
Contributor
Contributor

How to create a date range that begins on the last 3 days of a specific Month

Hi All,

Not a QlikView developer at all so I am seeking assistance on how I can create a date range that begins on the last 3 days of a specific month?

Bigger Picture :

I am trying to automate a load on my QV report but there are two sources and it varies which source to load depending on the date.  

Ex. If the DATE is equal to the last 3 days of February to 14th of March 

then 

Load from: Datasource2

else

Load from: Datasource1

 

Please advise.

Labels (2)
1 Reply
kushalthakral
Creator III
Creator III

Hi 

 

You can achieve this by using the script below, it is just an example you can modify as per your need 

 

 

For i = -3 to 13

Table:
Load
Date(Num(Monthstart(Addmonths(Today(),-1)))+$(i)) AS Date
AutoGenerate 1
;

Next ;


NoConcatenate

Table2:
Load

Today()-2 AS Date
, If(Exists(Date,Today()-2),'Yes','No') As Cond

AutoGenerate 1;


Let vCondition = Peek('Cond',0,Table2);


if vCondition = 'Yes' then

Load
'Yes' AS Data
AutoGenerate 1;

else

Load
'No' AS Data
AutoGenerate 1;

ENDIF;

 

Let me know in case of any difficulty

 

Thanks

Kushal