Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
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
MVP
MVP

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

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?

MVP
MVP

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

MVP
MVP

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.

MVP
MVP

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?!

MVP
MVP

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