Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

mendoncart
New Contributor III

Autogenerate

Hey guys.

I'm having some trouble with this function.

The thing is that i have a budget table that the records are made by start and end date.

So, it's like this:

     Product      Start Date     End Date     Value

     Product A     201301          201307     1000

and i would like to make a table like this:

     Product         Date        Value

     Product A     201301      1000

     Product A     201302      1000

     Product A     201303      1000

     Product A     201304      1000

     Product A     201305      1000

     Product A     201306      1000

     Product A     201307      1000

I know that autogenerate probably will do the trick but i just don't know how to do it.

So, can anyone help me out?

PS: Did i posted in the right place?

Thanks

1 Solution

Accepted Solutions
joonasjaspi
New Contributor III

Re: Autogenerate

Looping works. Something like this:

LOAD

Product,

Value,

StartDate + iterno() - 1 as Date

Resident Temp

while StartDate + iterno() - 1 <= EndDate ;

4 Replies
MVP
MVP

Re: Autogenerate

joonasjaspi
New Contributor III

Re: Autogenerate

Looping works. Something like this:

LOAD

Product,

Value,

StartDate + iterno() - 1 as Date

Resident Temp

while StartDate + iterno() - 1 <= EndDate ;

Not applicable

Re: Autogenerate

Try like below:

LOAD Product ,

        Value,

        [Start Date] + IterNo() -1 AS Date

FROM SOURCETABLE

While [Start Date] + IterNo() -1 <= [End Date];

Please find the attached qvw as reference.

MVP
MVP

Re: Autogenerate

Hi,

Try like this

TABLE:

LOAD Product ,

  Value,

  Date(MonthStart(StartDate, IterNo() -1), 'YYYYMM') AS Date

While Date(MonthStart(StartDate, IterNo() -1), 'YYYYMM') <= EndDate;

LOAD Product,

Date(Date#([Start Date], 'YYYYMM')) AS StartDate,

Date(Date#([End Date], 'YYYYMM')) AS EndDate,

Value

Inline [

Product,  Start Date,     End Date,    Value

Product A , 201301, 201307,     1000];

Regards,

Jagan.

Community Browser