Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
AndyC
Contributor III
Contributor III

Adding a Date Column to existing table to create one master to many dates

I am trying to generate a matrix table with two columns:

Partcode , Date  

I have the table of partcodes and I want to add a series of dates to each partcode record between a mix and max date.

So I start with a table containing just partcode,

A

B

C

D

etc..

and end up with two columns...

A, 2024-04-01 - this will be a Date() field but wanted to show the date so it doesn't confuse Americans 😉 

A, 2024-04-02

A, 2024-04-03

B, 2024-04-01

B, 2024-04-02

B, 2024-04-03

C, 2024-04-01

C, 2024-04-02

C, 2024-04-03

etc..

I know how to generate a table of dates but I just can't work out how to join the two!

MasterCalendar:
LOAD TempDate As CalendarDate;
LOAD Date($(vStartDate) + IterNo()) AS TempDate
AutoGenerate 1
While $(vStartDate) + IterNo() <= $(vEndDate);
 
Partcodes:
LOAD
Distinct
    PART_NO  
Resident SalesData;
 
So, essentially read through the Partcodes table and for each row add all the rows from the master record.
 
Anyone got an idea?

 

Labels (1)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

Just write "Join" between the two tables:

MasterCalendar:
LOAD TempDate As CalendarDate;
LOAD Date($(vStartDate) + IterNo()) AS TempDate
AutoGenerate 1
While $(vStartDate) + IterNo() <= $(vEndDate);
 
Join
LOAD
Distinct
    PART_NO  
Resident SalesData;

View solution in original post

2 Replies
hic
Former Employee
Former Employee

Just write "Join" between the two tables:

MasterCalendar:
LOAD TempDate As CalendarDate;
LOAD Date($(vStartDate) + IterNo()) AS TempDate
AutoGenerate 1
While $(vStartDate) + IterNo() <= $(vEndDate);
 
Join
LOAD
Distinct
    PART_NO  
Resident SalesData;
AndyC
Contributor III
Contributor III
Author

So obvious now you've mentioned it!

😁 'Embarrassed Emoji'

Thanks for helping