Usage of Keep Command in QlikView

Last updated on Oct 25 2021
Harshal Shah

Table of Contents

Usage of Keep Command in QlikView

The keep command in QlikView is used to combine data from two data sets keeping both the data sets available in memory. It is very similar to joins we covered in the previous chapter except for two major differences. First difference is − in case of keep; both the datasets are available in QlikView’s memory while in join the load statements produce only one data set from which you have to choose the columns. The second difference being − there is no concept of outer keep where as we have outer join available in case of joins.

Input Data

Let us consider the following two CSV data files, which are used as input for further illustrations.

Product List:

ProductID,ProductCategory

1,Outdoor Recreation

2,Clothing

3,Costumes & Accessories

4,Athletics

5,Personal Care

6,Hobbies & Creative Arts

 

Product Sales:

ProductID,ProductCategory,SaleAmount

4,Athletics,1212

5,Personal Care,5211

6,Hobbies & Creative Arts,1021

7,Display Board,2177

8,Game,1145

9,soap,1012

10,Beverages & Tobacco,2514

Inner Keep

We load the above input data using the script editor, which is invoked by pressing Control+E. Choose the option Table Files and browse for the Input file. Then we edit the commands in the script to create an inner keep between the tables.

image1 27

Inner keep fetches only those rows, which are present in both the tables. In this case, the rows available in both Product List and Product Sales table are fetched. We create a Table Boxes using the menu Layout → New Sheet Objects → Table Box.

First, we choose only the productSales table, which gives us the fields – ProductID, ProductCategory and SaleAmount to be displayed.

image2 23

Next, we choose the ProductList data set, which gives us the fields ProductID and ProductCategory.

image3 20

Finally, we choose the All Tables option and get all the available fields from all the tables.

image4 19

The following report shows all the Tables Boxes from the above given steps.

image5 15

Left Keep

Left keep is similar to left join, which keeps all the rows from the table in the left along with both the data set being available in QlikView’s memory.

Left keep Script

The following script is used to create the resulting data sets with left keep command.

productsales:

LOAD ProductID,

     ProductCategory,

     SaleAmount

FROM

[C:\Qlikview\data\product_lists.csv]

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




left keep(productsales)

productlists:

LOAD ProductID,

     ProductCategory

FROM

[C:\Qlikview\data\Productsales.csv]

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

Left keep Data 

When we change the script as above and refresh the data in the report using Control+R, we get the following data in the sheet objects.

image6 12

Right Keep

Right keep is similar to left join, which keeps all the rows from the table in the right along with both the data set being available in QlikView’s memory.

Right keep Script

The following script is used to create the resulting data sets with left keep command.

productsales:

LOAD ProductID,

     ProductCategory,

     SaleAmount

FROM

[C:\Qlikview\data\product_lists.csv]

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

right keep(productsales)

productlists:

LOAD ProductID,

     ProductCategory

FROM

[C:\Qlikview\data\Productsales.csv]

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

Right keep data

When we change the script as above and refresh the data in the report using Control+R, we get the following data in the sheet objects.

image7 9

So, this brings us to the end of blog. This Tecklearn ‘Usage of Keep Command in QlikView’ blog helps you with commonly asked questions if you are looking out for a job in QlikView BI. If you wish to learn QlikView and build a career in Business Intelligence domain, then check out our interactive, QlikView Certification Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/qlik-view-certification-training/

QlikView Certification Training

About the Course

Tecklearn’s QlikView Certification Training will help you become an expert in Data Visualization with QlikView. Learn all the basics and advanced features of QlikView such as data modelling, reports and dashboards, visualization, object formatting, system table etc. Along with this, you will be given hands-on working experience on real-time projects that will help you pass the QlikView certification exam. You also get hands-on experience in QlikView applications.

Why Should you take QlikView Training?

  • The average annual pay for a QlikView Professional is $122,000. -PayScale.com.
  • Deloitte, Cisco, Qualcomm, Sony, AON & other top Fortune 500 companies use QlikView
  • QlikView – A Leader in 2017 Gartner Magic Quadrant for Business Intelligence & Analytics Platforms (For 7th Consecutive Year)

What you will Learn in this Course?

Introduction to QlikView

  • Concept of Business Intelligence
  • Features and components of QlikView
  • Comparison with other BI tools
  • Architecture
  • Installation & Navigation
  • QVS, QVW and .log files
  • Sheet Objects
  • Dimensions and Expressions
  • Various file types and extensions

Various QlikView Products

  • Overview of the various QlikView products

Introduction to Data and Scripting

  • Structuring the Script
  • Create tabs in the scripts, Debugging of scripts
  • Hands On

Data Model

  • QlikView Data File Types: QVD, QVX
  • System fields
  • Star schema
  • Synthetic Key Tables
  • Data Modelling Considerations
  • Straight and Pivot Table
  • Hands On

Components of Qlik View

  • Sheets and Sheet Objects
  • The List Box
  • The Table Box
  • The Multi Box
  • The Button & Text Object
  • Basic Charts
  • Hands On

Set Analysis

  • Set analysis
  • Working with modifiers, identifiers, operators, example of expressions,
  • Indirect set analysis
  • YTD & MTD

QlikView Functions, Reports and Charts

  • Uses of Expressions
  • Chart Properties: Dimensions
  • Qlikview Functions
  • Adhoc Reports
  • Incremental Load using QVD Files
  • Bookmarks
  • Hands On

Data Analysis

  • What-if Analysis
  • Comparative Analysis
  • Dynamic Reporting or Ad-hoc Reporting
  • Document Analyzer

QlikView Security

  • QlikView security
  • Defining the access controls and levels of access
  • Maintaining the access control database

QlikView Administration

  • QMC (QlikView Management Console)
  • Server Installation & Deployment
  • QlikView Project

Got a question for us? Please mention it in the comments section and we will get back to you.

 

0 responses on "Usage of Keep Command in QlikView"

Leave a Message

Your email address will not be published. Required fields are marked *