Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Autogenerate dates in a certain range

Hello! I have data in the format of the table below:

start_datecompany_namepay_model
2015-10-01Company11
2015-12-01Company21
2016-01-01Company32
2015-12-01Company46

I want to expand the table to showing dates up to 2016-01-01 for each company:

start_datecompany_namepay_model
2015-10-01Company1

1

2015-11-01Company1

1

2015-12-01Company11
2016-01-01Company11
2015-12-01Company21
2016-01-01Company21
2016-01-01Company32
2015-12-01Company4

6

2016-01-01Company46

So far, i've auto generated the dates but all my solutions gives each company_name the same time span, Company1 spans from 2015-10-01 to 2016-01-01 (which is correct) but so does also the other companies.

Any suggestions on how this can be achieved?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try something like

SET DateFormat = 'YYYY-MM-DD';

LOAD Date(Addmonths(start_date,iterno()-1)) as start_date, company_name, pay_model

FROM ....

WHILE AddMonths(start_date,iterno()-1) <= makedate(2016,1);

View solution in original post

2 Replies
swuehl
MVP
MVP

Try something like

SET DateFormat = 'YYYY-MM-DD';

LOAD Date(Addmonths(start_date,iterno()-1)) as start_date, company_name, pay_model

FROM ....

WHILE AddMonths(start_date,iterno()-1) <= makedate(2016,1);

Not applicable
Author

That worked exactly as I wanted it to! Thank you so much for shortening my evening working session