Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Keep keyword

Hi Team,

Would anyone can tell me the purpose/use of keep keyword. I read it you can use it JOIN/KEEP keyword where join will join and will show 1 table, KEEP keyword keeps 2 tables. my question is that why we would need KEEP keyword in real time?

Thanks.

5 Replies
avinashelite

Eg

If you have table 1 with 10 columns and 10K records and  table 2 with 4 columns and 20 records.

In this case if you join the table2 with table1 then it will generate 10K records for the 3 columns in the table1 which is not feasible intend of that   Keep just reduce the data in the table 2 in accordance with table 1 without joining and creating additional records


Hope this helps you 

tresesco
MVP
MVP

This has been discussed here: Re: KEEP command - why to use that?

vinieme12
Champion III
Champion III

read this thread

Understanding Join, Keep and Concatenate

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sdmech81
Specialist
Specialist

There are many advantages of keep compared to join but it depends on the scenario:

It will avoid one to many relation wrong calculations,check here when to use Join and when to use Keep ?

its use can also reduce the table size.

Take scenario where u have master calendar with future date and there is one main data table.Its not recommended to join data with calendar, though you can associate but using Keep will also solve the purpose and also reduce the data size by comparing dates in main table.

hope it helps.

Sachin

jonathandienst
Partner - Champion III
Partner - Champion III

One scenario that I commonly use is to reduce dimensions so that only the relevant dimension values get loaded 0 like this:

Transactions:

LOAD TransID,

  TypeCode,

  ...

 

Left Keep(Transactions)

TypeCodes:

LOAD TypeCode,

  TypeDescription,

  TypeCategory,

  ...

But one could also use this for the same result:

Transactions:

LOAD TransID,

  TypeCode,

  ...


TypeCodes:

LOAD TypeCode,

  TypeDescription,

  TypeCategory,

  ...

WHERE Exists(TypeCode)

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