Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

generating date for every value in a table

hi guys

I have a table which has products for example

Product

A

B

I want the output table as follows:

Product MonthYear

A          Jan 2014

A          Feb 2014

A          Mar 2014

A          Apr 2014

B        Jan 2014

B          Feb 2014

B          Mar 2014

B          Apr 2014

Please help

2 Replies
Not applicable
Author

Hi

create a calendar table wich every year-month you need  and join it with your product table

best regards

Chris

maxgro
MVP
MVP

Products:

load * inline [

Product

A

B

];

t:

load

  date(makedate(2014) + rowno()-1) as d

AutoGenerate 365;

Months:

load

  distinct

  capitalize(date(MonthStart(d), 'MMM YYYY')) as Month

resident t

Where month(d) <= 4

;

drop table t;

join (Products)

load * Resident Months;

DROP Table Months;