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: 
Not applicable

Generate Periodic Datas

Hi every one,

I need to create periodic data from a table, I try for a For Loop without sucess, I think maybe AutoGenerate can help me but I think this goes far beyond me...

So, here is my issue :

I have a table with this kind of datas :

ID (Primary key)

Start Date

Nb of echeance

Periodicy (in month, 1 or 3)


For exemple :

ID ---- Date ---- NBE ---- PERIO

1 ---- 10/10/2014 --- 5 ---- 3

2 ---- 01/01/2015 ----10 ----1


I Want to generate a table with this kind of data :

ID ---- DATE

1 ---- 10/10/2014

1 ---- 10/01/2015

1 ---- 10/04/2015

1 ---- 10/07/2015

1 ---- 10/10/2015

2 ---- 01/01/2015

2 ---- 01/02/2015

2 ---- 01/03/2015

2 ---- 01/04/2015

2 ---- 01/05/2015

2 ---- 01/06/2015

2 ---- 01/07/2015

2 ---- 01/08/2015

2 ---- 01/09/2015

2 ---- 01/10/2015


Could you help me with this ?


Thanks !




3 Replies
Not applicable
Author

Here is What I Try :

ABONNEMENTS:

SQL SELECT PABID,

      PABDATEDEBUT

      ,PABNBECHEANCES

      ,PABPERIODICITE

      ,PABNBECHEXE

  

  FROM PIECEABONNEMENT;

For i=0 to NoOfRows('ABONNEMENTS')-1

  Let StartDate=Peek('ABONNEMENTS.PABDATEDEBUT',$(i),'ABONNEMENTS');

  Let Perio=Peek('ABONNEMENTS.PABPERIODICITE',$(i),'ABONNEMENTS');

  Let NbEchenance=Peek('ABONNEMENTS.PABNBECHEANCES',$(i),'ABONNEMENTS');

  If ($(NbEchenance)>24) Then

  Set NbEchenance=24;

  End If

  For j=1 to $(NbEchenance)

  Let StartDate=AddMonths('$(StartDate)',$(Perio));

  FORECAST:

  LOAD

  '$(StartDate)' as Date,

  Peek('ABONNEMENTS.PABID',$(i),'ABONNEMENTS') as PABID;

  Next j;

Next i

This script seem to work in debug mode, I have no error and the loops are ok, but my tale FORECAST is not available in QlikView.

sasiparupudi1
Master III
Master III

please try this script

Untitled.jpg

temp:

load ID,Date(Date#(Date,'DD/MM/YYYY')) as MyDate,num(NBE) as NBE,num(PERIO) as PERIO inline

[

ID , Date , NBE , PERIO

1 ,10/10/2014,5,3

2 ,01/01/2015,10,1

]

;

NoConcatenate

New:

load ID,NBE,PERIO,AddMonths(MyDate,(IterNo()-1)*PERIO) as MyDate  //,IterNo() as x

  while IterNo()<=NBE;

load * Resident temp order by MyDate;

drop Table temp;

Not applicable
Author

Hi Sasidhar,

I'm sorry. I'm not a pro, I have a error message with your code :

Field not found

load * Resident temp order by MyDate

Could you help me ?