Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

danielrogra
New Contributor III

Left keep not working as expected

Hello all. First of all thank you for your time.

I'm sure there is something I'm missing, but left keep is not working as I expected. Let me explain:

Let's say I have two tables:

Table A:

NameYearMonth
A20181
B20182

Table B:

Name

AmountProduct
A187
C290
A350

What I need? I need to load the first Table and then load the second table only when the name is on the table A.

What have I done? I've loaded the whole table A. Then I use left keep as follow:

Table B:

Left Keep(Table A)

Load *;Select * from TableB;

So I got two tables, but it seems that the user A appears just once on the table B. If I use Left Join it works perfectly but I need to understand why left keep is not working, and also I prefer to have two tables instead of only one with all the information.

Is there anyone who can help me?

Thank you in advance

Daniel

EDIT:

I've found the solution, but I don't understand where was the issue...

I forgot to mention that I had another table (With dates) between tables A and B, and I was using just "left keep". Now I've added "left keep (Table A) and it's working as expected...Does it make sense?

Thank you!

1 Solution

Accepted Solutions
MVP
MVP

Re: Left keep not working as expected

EDIT:

I've found the solution, but I don't understand where was the issue...

I forgot to mention that I had another table (With dates) between tables A and B, and I was using just "left keep". Now I've added "left keep (Table A) and it's working as expected...Does it make sense?

Thank you!

Yes, this does make sense. A LEFT KEEP without the explicte table name will refer to the last table loaded.

Does this last table share more than the Name key field with your LEFT KEEP table, maybe Name and Product?

10 Replies
agigliotti
Honored Contributor II

Re: Left keep not working as expected

I think you just need to do as below:

load * from TableA;

left keep

load * from TableB;


Hope it helps.

MVP
MVP

Re: Left keep not working as expected

Not sure why the LEFT KEEP is not working. It's working fine at my side using INLINE tables.

As an alternative, you can replace the LEFT KEEP with an WHERE clause:

Table B:

Load *

WHERE EXISTS(Name);

Select * from TableB;

sumanta12
Contributor II

Re: Left keep not working as expected

PIC1.PNG

zebhashmi
Valued Contributor

Re: Left keep not working as expected

Why are you using Load and select same time?

danielrogra
New Contributor III

Re: Left keep not working as expected

Hi Andrea, thank your for your time.

See the post, I guees I've found the solution but I still don't understand why it was an issue...

Many thanks

danielrogra
New Contributor III

Re: Left keep not working as expected

Hi Stefan, thank your for your time and your tip about using exists.

See the post, I guees I've found the solution but I still don't understand why it was an issue...

Many thanks

danielrogra
New Contributor III

Re: Left keep not working as expected

Hi Sumanta, thank your for your time.

See the post, I guees I've found the solution but I still don't understand why it was an issue...

Many thanks

danielrogra
New Contributor III

Re: Left keep not working as expected

Hi Jahanzeb, thank you for your time.

I'm kind of new to QlikSense, so maybe I'm not doing the right thing...

I usually connect to a database using SQL. I've seen that many people just load the whole table and then, using "qlik syntaxis" make all the changes they need (Maybe you just one to show the last record per ID,etc).

As I used to use SQL and I'm new to Qlik, I prefer to use SQL to make all the changes I need in the select and then load my table. Is that the best way? I don't really know....Is it better to transform the table using SQL rather tan Qlik syntaxys? Still don't know....

If you could help me I'll be so happy

Thank you!

MVP
MVP

Re: Left keep not working as expected

EDIT:

I've found the solution, but I don't understand where was the issue...

I forgot to mention that I had another table (With dates) between tables A and B, and I was using just "left keep". Now I've added "left keep (Table A) and it's working as expected...Does it make sense?

Thank you!

Yes, this does make sense. A LEFT KEEP without the explicte table name will refer to the last table loaded.

Does this last table share more than the Name key field with your LEFT KEEP table, maybe Name and Product?