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

Concatenate two tables with focus on WeekDay

Hello,

I'd like to concatenate these two tables.

But the problem is that WeekDay field from the first isn't equals to WeekDay from the second.

How to concatenate in this case and apply a "date" format to the crosstable's field? (I can't change WeekDay from the first table to text)

Example:

Table1:

load ID, Sales,

Store,

WeekDay(Date) as WeekDay,  // Mon, Tue, etc.

from source_1;

CrossTable('WeekDay', 'Sales', 2)

Table2:

load ID, Store

Monday as Mon,

Tuesday as Tue,

Wednesday as Wed

.. etc.

from source_2;


With best regards,

Evgeniy Sharahov

1 Solution

Accepted Solutions
sunny_talwar

Try this

Concatenate (Table1)

LOAD ID,

     Store,

     Dual(Week, (Match(Week, 'Sun', 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat') - 1)) as WeekDat,

     Sales

Resident Table2;

View solution in original post

10 Replies
sunny_talwar

May be like this

Table1:

LOAD ID, Sales,

     Store,

     Text(WeekDay(Date)) as WeekDay,  // Mon, Tue, etc.

from source_1;

CrossTable(WeekDay, Sales, 2)

Table2:

LOAD ID,

     Store

     Monday as Mon,

     Tuesday as Tue,

     Wednesday as Wed

     .. etc.

from source_2;

Or this

Table1:

LOAD ID, Sales,

     Store,

     WeekDay(Date) as WeekDay,  // Mon, Tue, etc.

from source_1;

Table2:

CrossTable(Week, Sales, 2)

LOAD ID,

     Store

     Monday as Mon,

     Tuesday as Tue,

     Wednesday as Wed

     .. etc.

from source_2;


Concatenate (Table1)

LOAD ID,

     Store,

     Dual(Week, Match(Week, 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun')) as WeekDat,

     Sales

Resident Table2;


DROP Table Table2;

Anonymous
Not applicable
Author

Thank you for the quick response!

I've chosen the second.  I'm afraid but It doesn't work correctly. How to fix them?

sunny_talwar

What is the issue you run into?

Anonymous
Not applicable
Author

I've got two Sundays by the second one. Why? 😃  It isn't correct

sunny_talwar

By the second one? Can you show this in an image?

Anonymous
Not applicable
Author

There is a list with two Sundays.

sunny_talwar

Try this

Concatenate (Table1)

LOAD ID,

     Store,

     Dual(Week, (Match(Week, 'Sun', 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat') - 1)) as WeekDat,

     Sales

Resident Table2;

Anonymous
Not applicable
Author

Two Saturdays . What's wrong?!

sunny_talwar

Can you run this for me

Table1:

LOAD ID, Sales,

    Store,

    WeekDay(Date) as WeekDay, // Mon, Tue, etc.

    Num(WeekDay(Date)) as WeekDayNum

from source_1;

and then create a table box with WeekDay and WeekDayNum fields and share a screenshot

Don't add the crosstable load after this...