Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with Joins

Hi, guys!

I have a problem here with Joins.

This is my first Table:

EmployeeAccountPeriodDataAccount
Pavel KovalskiInternationalFeb-140
Pavel KovalskiBankMar-140
Pavel KovalskiOtherApr-140

This is my second table:

EmployeePeriodBench
Pavel KovalskiFeb-140
Pavel KovalskiMar-141
Pavel KovalskiApr-141


I need to join them, so that I'll get a table with Employee, Account, Period , DataAccount and Bench.

I make it like:

Left Join(Table 1)
Load  Employee, Bench as Bench_FTE
Resident 1;


But all I get is :


EmployeeAccountPeriodBench_FTEDataAccount
Pavel KovalskiInternational Feb-140
Pavel KovalskiInternational Feb-140
Pavel KovalskiBankMar-1410
Pavel KovalskiBankMar-141,00
Pavel KovalskiOtherApr-1410
Pavel KovalskiOtherApr-141,00

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Or change the overly complex calculation of the Period column in Accounts and Bench into something like:

...date(MonthStart(date#(Period, 'DDMMYY')), 'MMM YY') AS Period, ...

View solution in original post

15 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Please post a sample QVW document and sample data to allow more specific and accurate assistance.

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
PrashantSangle

Hi,

Can you post complete script??

simple left join must work

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Hi,Max

Here is my complete script:

Data:

CrossTable(Month, DataAccount, 11)

Load *

FROM

[Billable SWE1415.csv]

(txt, codepage is 1252, embedded labels, delimiter is ';', msq);

Accounts:

load

Employee,

MonthName(Date(MakeDate(20&num#(Right(Month,2)),num#(Mid(Month,4,2)),num#(Left(Month,2))),'MMM.YY')) as Period,

num#(DataAccount,'#,##') as DataAccount,

Account

Resident Data;

Drop Table Data;

2:

CrossTable(Period, Bench, 10)

LOAD *

FROM

Bench_JanDec2015.csv

(txt, codepage is 1252, embedded labels, delimiter is ';', msq);

Bench:

Load Employee ,

MonthName(Date(MakeDate(20&num#(Right(Period,2)),num#(Mid(Period,4,2)),num#(Left(Period,2))),'MMM.YY')) as Period,

num#(Bench,'#,##') as Bench

Resident 2;

Drop Table 2;

1:

Load Employee as Name ,Period,Bench

Resident Bench;

Drop Table Bench;

Left Join(Accounts)

Load  Name as Employee, Bench as Bench_FTE

Resident 1;

Anonymous
Not applicable
Author

It should be:

Left Join("Table 1")
Load  Employee, Period, Bench as Bench_FTE
Resident "Table 2";

Not applicable
Author

Michael,

It gives me the same result

Anonymous
Not applicable
Author

Impossible...  I'll try later.

Anonymous
Not applicable
Author

It works - see attached.  You're missing something...

Not applicable
Author

I guess I have problems with Data format...

Anonymous
Not applicable
Author

Most likely.  It looks the same 'Feb-14', but in fact it could be February 1, 2014 in one place but February 28, 2014 in another - no match.  If you remove third parameter in your makedate() function, they all will be the 1st day of month and will match.