Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
evgeniyita
Contributor

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

Re: Concatenate two tables with focus on WeekDay

Try this

Concatenate (Table1)

LOAD ID,

     Store,

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

     Sales

Resident Table2;

10 Replies

Re: Concatenate two tables with focus on WeekDay

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;

evgeniyita
Contributor

Re: Concatenate two tables with focus on WeekDay

Thank you for the quick response!

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

Re: Concatenate two tables with focus on WeekDay

What is the issue you run into?

evgeniyita
Contributor

Re: Concatenate two tables with focus on WeekDay

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

Re: Concatenate two tables with focus on WeekDay

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

evgeniyita
Contributor

Re: Concatenate two tables with focus on WeekDay

There is a list with two Sundays.

Re: Concatenate two tables with focus on WeekDay

Try this

Concatenate (Table1)

LOAD ID,

     Store,

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

     Sales

Resident Table2;

evgeniyita
Contributor

Re: Concatenate two tables with focus on WeekDay

Two Saturdays . What's wrong?!

Re: Concatenate two tables with focus on WeekDay

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...