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

Joining dates

Good day!

Colleagues, i have some simple model to understand how to join (fill) values by some key field.

I load main table from sheet S1:

   

IdDateSales
101.01.201634
104.01.20167
106.01.20162
107.01.20165

then i need to join to this table all dates by Id field from sheet S2.

My necessary result table:

   

IdDateSales
101.01.201634
102.01.2016-
103.01.2016-
104.01.20167
106.01.20162
107.01.20165
110.01.2016-

Help, please!

1 Solution

Accepted Solutions
perumal_41
Partner - Specialist II
Partner - Specialist II

I did small mistake and  change the below script

like


Temp1:

LOAD
Warehouse//,
   //[Nomenclature Id]
FROM
C:\Users\perumal_ayyappan\Desktop\Test.xlsx
(
ooxml, embedded labels, table is S1);

Join


LOAD Id,

Date,
[Nomeclature Id] as [Nomenclature Id]

FROM



(
ooxml, embedded labels, table is S2);



MyData:

LOAD Id,

Warehouse,

Date,

Sales,
[Nomenclature Id]

FROM



(
ooxml, embedded labels, table is S1);





Outer Join (MyData)





Load * Resident Temp1;



Drop table Temp1;

View solution in original post

26 Replies
Chanty4u
MVP
MVP

T1:

load *,

All fields

from Table 1:

concatenate(T1)

T2:

Load

*,

all

from

sheet 2;

sunny_talwar

May be you want to concatenate the two tables?

kkkumar82
Specialist III
Specialist III

If both the sheets contain same number of fields with same names they will be automatically concatinated I mean joined in your language.

Is that what you wanted.

sunny_talwar

Why did you remove your 1st comment? I think Master Calendar is the way to go here Kumar

kkkumar82
Specialist III
Specialist III

Hi Sunny,

Love to talk to you once directly if possible, over enthusiast .

I thought by looking the post that there is only one table with the first dates and need to fill the other dates, so went for suggesting master calendar, but as I re looked there are two tables that is why I removed the comment.

I thing I am correct atleast now.

Anonymous
Not applicable
Author

i don't know what in this case i must to do (Join or Concat)..

I need to get result described above..

This is test example, but in my real data there more fields (id, City and others), but dates must be joined to Main tables by Id field.

Anonymous
Not applicable
Author

Thanks.

But i thing, tables concatenating  is not right solution for my problem.

For example, my first table can consist one more field, for example Warehouse id (Value 1 in field Id has matching value 3334 in Warehouse_Id field ) and in this case result table after joining dates must be:

    

IdWarehouse_IdDateSales
1333401.01.201634
1333402.01.2016-
1333403.01.2016-
1333404.01.20167
1333406.01.20162
1333407.01.20165
1333410.01.2016-

Thanks for help.

jlongoria
Creator
Creator

First, please review this article on join, keep, and concatenate: Understanding Join, Keep and Concatenate

One approach given the spreadsheet data and your expected results is to outer join S1 and S2.

MyData:
LOAD Id,
Date,
Sales
FROM
[data.xlsx]
(
ooxml, embedded labels, table is S1);

Outer Join (MyData)

LOAD Id,
Date
FROM
[data.xlsx]
(
ooxml, embedded labels, table is S2);

Anonymous
Not applicable
Author

Thanks Dear.

In your example.

If i add some one field to S1 sheet, for examplem warehouse, Dates from S2 don't connect with it:

MyData:

LOAD Id,

Warehouse,

Date,

Sales

FROM

[Test.xlsx]

(ooxml, embedded labels, table is S1);

Outer Join (MyData)

LOAD Id,

Date

FROM

[Test.xlsx]

(ooxml, embedded labels, table is S2);

Result:

    

IdWarehouseDateSales
1Main01-01-201634
1Main04-01-20167
1Main06-01-20162
1Main07-01-20165
1 02-01-2016
1 03-01-2016
1 10-01-2016

Necessary result:

    

IdWarehouseDateSales
1Main01-01-201634
1Main04-01-20167
1Main06-01-20162
1Main07-01-20165
1Main02-01-2016
1Main03-01-2016
1Main10-01-2016